how appoint a subdomain for a s3 bucket?

samuel_R picture samuel_R · Sep 12, 2013 · Viewed 24.6k times · Source

Good morning,

I am using amazon s3 bucket as the image server. And I want to use a subdomain of my site, how to address this bucket. eg: a picture is now in: https://s3-sa-east-1.amazonaws.com/nomeBucket/pasta/imag.png, and I access it through this same link.

Would that it were so: imagens.mydomain.com.br / folder / imag.png Is there any way I can do this? appoint a subdomain address to a bucket? I've tried the amazon route 53, as CNAME. I tried this: https://s3-sa-east-1.amazonaws.com/nomeBucket/

I took the test yesterday, but apparently it did not work. Someone already did something similar, and / or know how to help me?

Note: I'm using nginx. also need to configure it for subdomain?

Thank you

Answer

dcro picture dcro · Sep 12, 2013

You need to rename your bucket to match the custom domain name (e.g. imagens.mydomain.com.br) and set up that domain as a CNAME to

<bucket-name>.s3.amazonaws.com.

(in your case imagens.mydomain.com.br.s3.amazonaws.com.

The full instructions are available here:

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