Customize your Amazon S3 Url

Amazon s3I see a lot of sites still using the long default Amazon S3 url so I thought this might be helpful to someone. Lets say I setup a bucket for images on this domain at images.wrichards.com.s3.amazonaws.com to serve all my images. I don’t really want to type out the extra s3.amazonaws.com bit everytime I link to an image. 😛 There is a quick and easy solution to change your domain with CNAME:

images.wrichards.com CNAME images.wrichards.com.s3.amazonaws.com

Just add a CNAME record with that information and you should be good to go (obviously change my domain to yours). You can add your CNAME in your DNS entry More Info here. I can now access my bucket via the custom domain images.wrichards.com.The bucket name must match and be lowercase for this to work properly.

, , ,

  • http://aaron.aminus3.com Aaron Schmidt

    Hi,

    Will the following work?

    images.example.com CNAME
    example.s3.amazonaws.com

    I.e. does the bucket name have to match the full domain name?

  • Bill

    Hi Aaron,

    Unfortunately, the bucket name has to match the full domain. So in your case:

    images.example.com CNAME
    images.example.com.s3.amazonaws.com

  • Khal

    Hi

    I tried doing this. Took a few attempts .. but got it working.. both this post and this post

    http://carltonbale.com/how-to-alias-a-domain-name-or-sub-domain-to-amazon-s3

    were never clear on things.. let me give it a shot for people who get stuck..

    You want your url like

    http://superman.site.com/

    Or

    http://coolservername.site.com/

    agreed?

    Good..

    1) Create your subdomain on your domain Cpanel folder.

    For this example, I own test.com and the subdomain I created is batman.test.com

    2) Open Cloud Explorer (free amazon s3 kit) and create your bucket.. this is the important part..

    your bucket name must be your entire subdomain name

    So create
    “batman.test.com” as a bucket and not “batman”

    NOW you can follow the rest of these tutorials

    3) Your name should be a new CNAME entry for your domain. For my example of batman.test.com, the entry was:

    * Name: batman
    * Type: CNAME
    * Value: s3.amazonaws.com.
    * (If you are an European users, use s3-external-3.amazonaws.com. instead)

    Thats it!

    http://test.batman.com/loads/bucket/subfolders/logo.png

    Enjoy!!

  • http://twitter.com/benjaminsull Benjamin Sullivan

    I followed Khal’s instructions and it worked fine. However I needed to create a bucket policy before the items in the bucket could be accessed publicly. For the CNAME, I pointed it to s3.amazonaws.com just like Khal said. I DID NOT NEED TO point it to my_bucket_name.s3.amazonaws.com.

Powered by WordPress. Designed by Woo Themes