S3 Static Website Hosting When Creating Bucketname?

I am trying to host a simple static website from my AWS account using S3. I had an old dusty account with a lot of strange settings from testing over the years, I also had an S3 account with a bucket of "mypersonaldomain.com" and "wwww.mypersonaldomain.com". In any case, I wanted to start a new one, so I canceled my account to start a new one.

Now that I'm going to create "mypersonaldomain.com" and "www.mypersonaldomain.com", he says that the bucket name is accepted, even if the account was deleted some time ago. I assumed that Amazon will release the name bucketname to the public. However, when I deleted the account, I obviously did not delete the buckets in advance.

I get the impression that for S3 for static web hosting, the bucket names must match the domain name for DNS to work. However, if I cannot create a bucket with my own name, can I still use S3 for static hosting? Its just a simple site with low traffic, which does not have to be in an EC2 instance.

FYI I am using Route 53 for my DNS.

[note "mypersonldomain.com" is not an actual domain name]

+6
source share
3 answers

One way to solve your problem is to keep your site on S3, but serve it through CloudFront:

  • You create a bucket on S3 with any name you like (there is no need to match the bucket name with your domain name).
  • You are creating a distribution on CloudFront .
  • You add the origin to your distribution pointing to your bucket.
  • You do the default behavior of your distribution to capture content from the source you created in the previous step.
  • You change the settings of your distribution to make it respond to your domain name by adding CNAME
  • You create a hosted zone on route 53 and create ALIAS records pointing to your distribution.

That should work. By doing this, you have the added benefit of potentially improving performance for your end users.

Also note that CloudFront was included in Free Tier a couple of months ago ( http://aws.amazon.com/free ).

+10
source

In my opinion, this is a terrific design flaw in the way S3 requires bucket names to be universally unique to all users.

I could, for example, make buckets for any well-known company name (if they were not accepted), and then legitimate users of these domains will be blocked from using them to create a static s3 website if they ever wanted to.

I never liked this requirement that s3 byte names should be unique to all users - a major design flaw (which, I am sure, had a legitimate reason when it was first developed), but cannot imagine that if AWS can go back to drawing board so they don’t change their mind now.

In your case with the deletion account, you should probably pay attention to s3 technical support - they can easily help you.

+7
source

I finally figured out the solution that worked for me. For my apex domain name, I use CloudFront, which is not a problem when someone already has my name in the bucket. The problem was redirected to www. I need a server to rewrite the url and issue a constant redirect. Since I use Elastic Beanstalk for my API, I used Nginx to do the redirection. You can read all the details on my post here: http://brettmathe.com/aws/aws-apex-redirect-using-elastic-beanstalk/

+1
source

All Articles