Access Amazon S3 buckets with your own CNAME domain

Amazon S3 is awesome for scalable hosting especially for images, videos and other assets.

If you still want to show your visitors your own domain instead of the s3.amazonaws.com domain for your assets then you can setup a CNAME record for your domain pointing to the S3 bucket.

Here’s how to do this:

  • Create a bucket in S3 and name it like your CNAME domain name.
    For example: images.yourdomain.com

Yes, your S3 buckets name should be the complete domain name.

  • Create a CNAME record for yourdomain.com like this:

images CNAME images.yourdomain.com.s3.amazonaws.com.

That’s it. Now a request to images.yourdomain.com/somefile.png will be mapped to s3.amazonaws.com/images.yourdomain.com/somefile.png.

share