BigBoy1337
BigBoy1337

Reputation: 4973

How can I point my amazon s3 pages to a custom domain?

My pyramid app permits users to, from www.domain.com to create new html pages in an amazon s3 bucket (call it "testbucket"). right now when the page is created, the user gets redirected to it at https://s3.amazonaws.com/testbucket/(some uuid). I want it so that it redirects them to www.subdomain.domain.com/(someuuid) where that html is stored. Right now this line is in my view callable (views.py)

 return HTTPFound(location="https://s3.amazonaws.com/testbucket/%(uuid)s" % {'uuid':uuid})

Ive read (http://carltonbale.com/how-to-alias-a-domain-name-or-sub-domain-to-amazon-s3/) that in order to do this I need to create a bucket on my amazon s3 account called subdomain.domain.com and then cname it to s3.amazon.com. (What is the extra . for?). What then should I put in my return HTTPFound call? Should it be:

 return HTTPFound(location="https://s3.amazonaws.com/subdomain.domain.com/%(uuid)s" % {'uuid':uuid})

That doesn't make any sense to me. What should it be instead?

Upvotes: 0

Views: 233

Answers (1)

Jeremy Roman
Jeremy Roman

Reputation: 16355

If you create the CNAME record (the trailing dot is a quirk of how DNS works; it means that the domain is fully-qualified), then you don't need to mention s3.amazonaws.com. Instead, you can redirect to http://subdomain.domain.com/your_object_here.

Note, however, that Amazon does not have an SSL certificate for your domain, so if you want to access it over SSL you will need to connect to s3.amazonaws.com (or bucket_name_here.s3.amazonaws.com).

As far as I know, S3 does not currently implement a means for supplying your own SSL certificate (and even if it did, it would presumably need to use a feature called Server Name Indication, which is not yet universally supported).

Upvotes: 2

Related Questions