amazon-web-servicesamazon-s3dnsaliascname

Amazon S3 CNAME setup - is s3.mydomain.com/myBucket1/myKey possible?


We have 1 bucket per client that we host data for, so I was hoping to alias s3.amazonaws.com to docs.mydomain.com using a CNAME record.

Since s3.amazonaws.com/myBucket1/myKey1 is a valid path, I was hoping docs.mydomain.com/myBucket1/myKey1 would work but it ends up looking for a bucket called docs.mydomain.com

Is there any way to accomplish what I am looking to do (perhaps not with CNAME however)?

Thanks in advance!


Solution

  • See this stackoverflow answer: Static hosting on Amazon S3 - DNS Configuration

    The instructions will let you create a bucket for each of your customers called 'docs.mydomain.com', and then tell you how to use a CNAME record to redirect those requests to the S3 bucket where the files really live.

    Unfortunately if your buckets already exist with content in them, there's no way to rename S3 buckets, so you'll need to create new ones with the correct names and copy the data into them.

    You can ignore his steps on handling naked domains if all you want is to handle that 'doc' subdomain.