How to Set a CNAME for an Amazon S3 Bucket

Setting a CNAME to an Amazon S3 Bucket is easy to do, but there are some things to watch out for.

Posted by David Coleman on November 21, 2018

If you want to use Amazon S3 to share files publicly for your website or to allow downloads, etc, you might want a URL that's prettier than the default that will be something like this: photos.havecamerawilltravel.com.photoshelter.com.s3.amazonaws.com

I might, for instance, just want to be able to use the URL: images.havecamerawilltravel.com

To do that, you can set a CNAME that points to your Amazon S3 bucket.

  1. First make sure that your bucket name is the same as your CNAME. For instance, if I want the CNAME to be photos.havecamerawilltravel.comotoshelter.com, I'd set the bucket name to photos.havecamerawilltravel.comotoshelter.com.
  2. Then you need to log into wherever your DNS settings are being maintained (if you haven't changed it, it's probably your web host), and create a new CNAME record for that domain. For the example above, I'd then point that CNAME to: photos.havecamerawilltravel.com.photoshelter.com.s3.amazonaws.com

In Cloudflare, for example, it would look like this:

Depending on the settings your DNS provider is using, it can sometimes take a little while (sometimes even a couple of hours) for the new link to work. Some DNS providers are much quicker than that.