website design gold coast
website design gold coast

How To Static Host (AWS)

Thumbnail_StaticHosting

Amazon Web Services offer the ability to create static sites that are globally fast and practically free to host via the S3 service.

To host a static website, you configure an Amazon S3 bucket for website hosting, and then upload your website content to the bucket.

The Following guide will take you though the process to setup a fast loading static site.

1. Go to the AWS Console

Here you will sign in and direct yourself to the navigation bar.

  • In the ‘Services’ dropdown menu click on the ‘S3’ link under ‘Storage’

2. Create a bucket

Make sure you name it with the exact domain name.

  • Select region: In our case it is Sydney
  • Continue to create the bucket
  • Once created click on your bucket and go into ‘Properties’
  • Click on ‘Static Website Hosting’
  • To enable, add index document – index.html
  • Go to ‘Permissions’ – click ‘Bucket Policy’

Copy and paste the code below:


{
"Version": "2012-10-17",
"Statement": [{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your_domain_name/*"
}]
}

*Note* Make sure to change your_domain_name in ‘Resource’ to your domain name without the www.

3. Create a Hosted Zone

  • In the ‘Settings’ drop down menu click on ‘Route53’ link under ‘Networking’
  • Go to ‘Hosted Zones’ – Create a hosted zone

4. Create ‘Record Set’

  • Under ‘ALIAS’ click ‘YES’ – Wait until target matches bucket created and select it (this may take a while to load… be patient)
  • Don’t forget the www alias
  • Add your other DNS settings as normal
  • Click create at bottom

Enjoy the almost free hosting! ٩(•̤̀ᵕ•̤́๑)

Now make it globally fast and add a free auto renewing SSL with the CloudFront CDN.

Request a certificate with the certificate manager. You will need to verify ownership of the domain with a validation email that is sent. So you will need a working email system for the domain.

Once you have the site on an S3 Bucket and can see this working well setup a CloudFront distribution for this site. The SSL works only through CloudFront.

  1. Important add Alternate Domain Names such as www.your_domain_name or it won’t show up in Route53
  2. Important Use the Certificate Manager (ACM) located in the US East (N. Virginia)
  3. Set origin and current web address.
  4. Leave other settings as default
  5. Select your SSL certificate in your Distribution Settings
  6. Specify a default root object ie index.html

Once your distribution is setup and Deployed correctly… in Route53 you should be able to select it in the A records as an “Alias Target”

Done! 🤓

Sharing is caring:

Created Jun 8, 2017 Made on the Gold Coast

Leave a Reply