skip to Main Content

I have a bucket on Amazon s3 which contains some jpeg images. For SEO purposes I want to serve my images from my subdomain like http://images.example.com

Currenly my bucket name does not looks like a subdomain. It only contains a dash like my-images

In this article, author says: Create a bucket which looks like a subdomain.

So can I alias my subdomain with CNAME record with this bucket name?

Also this solution support author’s idea: https://stackoverflow.com/a/18766082/1848929

Must I rename my bucket? Is it possible to rename a bucket?

2

Answers


  1. You need to create a bucket with the name images.example.com

    Then you will need to CNAME it in your DNS.

    images.example.com -> images.example.com.s3.amazonaws.com.

    Is it possible to rename a bucket?

    No, you can’t change the name of the bucket once it has been created. The workaround is to create a new bucket and copy the files to it.

    Login or Signup to reply.
  2. Your bucket name must match the CNAME (Or Alias) record you point to the bucket.

    The bucket name must be the same as the CNAME

    http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html

    It is not possible to rename a bucket. In the other answer you referenced, I suspect this was a casual use of the word “rename,” which actually was intended to mean “create a bucket with a different name,” because:

    After you create a bucket, you cannot change its name.

    http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html

    So, to point a DNS entry from one of your domains directly at a bucket, you will need a bucket with a matching name.

    There is one alternative, however, which does not require you to change the name of the bucket, which might be a good idea anyway: you can use the CloudFront CDN in front of your bucket.

    If you create a CloudFront distribution, you can tell CloudFront which DNS names you intend to point to it, and then configure CloudFront to serve the requests from a bucket you specify — and in this case, the name of the bucket no longer matters, because CloudFront handles the hostname-to-bucket mapping automatically.

    This further gives you the potential performance enhancement of caching your image assets closer to frequent visitors of your site, and allows you to use SSL with your subdomain as the hostname (using a free SSL cert from Amazon Certificate Manager) which is only possible with CloudFront+S3, not S3 alone.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search