Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

S3 Static Website Hosting when Bucketname is taken?

I'm trying to host a simple static website from my AWS account with S3. I had an old dusty account with lots of strange settings from testing over the years, I also had an S3 account with a 'mypersonaldomain.com' and 'wwww.mypersonaldomain.com' bucket. Anyways I wanted to start fresh so I canceled the account to start new.

Now when I go to create a 'mypersonaldomain.com' and 'www.mypersonaldomain.com' it says the bucket name is taken even though the account was deleted a while ago. I had assumed that amazon would release the bucketname back to the public. However when I deleted the account, I didn't explicitly delete the buckets beforehand.

I'm under the impression to use S3 for static website hosting the bucket names need to match the domain name for the DNS to work. However If I can't create a bucket with the proper name is there anyway I can use S3 for static hosting? Its just a simple low traffic website that doesn't need to be in an EC2 instance.

FYI I'm using Route 53 for my DNS.

[note 'mypersonldomain.com' is not the actual domain name]

like image 738
Mike Fisher Avatar asked Apr 02 '14 03:04

Mike Fisher


People also ask

Which of the following is required for S3 static Web site hosting?

To enable static website hostingSign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to enable static website hosting for. Choose Properties. Under Static website hosting, choose Edit.

Can static websites created with Amazon S3 be interactive?

You can use Amazon S3 to host a static website. On a static website, individual webpages include static content. They might also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts, such as PHP, JSP, or ASP.NET.


1 Answers

One way to solve your problem would be to store your website on S3 but serve it through CloudFront:

  1. You create a bucket on S3 with whatever name you like (no need to match the bucket's name to your domain name).
  2. You create a distribution on CloudFront.
  3. You add an origin to your distribution pointing to your bucket.
  4. You make the default behavior of your distribution to grab content from the origin created on the previous step.
  5. You change your distribution's settings to make it respond to your domain name, by adding a CNAME
  6. You create a hosted zone on Route 53 and create ALIAS entries 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 has been included in the Free Tier a couple months ago (http://aws.amazon.com/free).

like image 162
Bruno Reis Avatar answered Sep 28 '22 02:09

Bruno Reis