Hosting an inexpensive static website with Amazon S3

Posted by Jonathan Weyermann on September 5, 2017 at 5:41 AM

Aws s3

The beauty of AWS (Amazon Web Services) is that many services are per use, making low traffic sites very cheap to host. This is especially so if you create a static website which doesn't make use of Amazon EC2's. This can be achieved with AWS's S3 (Simple Storage Service). For many small businesses that don't have a lot of dynamic content on their site, and for which a content management system like Wordpress may be overkill, hosting a simple static site using S3 may be the way to go.

Unfortunately, using a S3 Bucket will require custom web design, as web hosting is not the primary purpose of S3. If you wish to design a site using drag and drop tools, using Weebly or a similar tool may be much easier. However, for those with free time, the need to customize, and the desire to get past a lot of its limitations, an amazon S3 static website may be the way to go

AWS Setup

1) You need at least a free Amazon AWS account (1st year you'll be in free tier (up to 5gb), after that it costs a small amount, depending on storage and network usage)

2) Once in the AWS Console, you need to navigate to S3 to create a new S3 bucket and set it to enable static hosting 

  1. on bucket creation, ensure you allow public access to read the bucket in 'Manage Public Permissions'
  2. Once you create the bucket, click into the bucket, go to 'Properties', and click on 'Static Website Hosting' and select 'Use this bucket to host a website' and set the index.html (setting it it to index.html is fine)

3) You can setup Cloudfront to serve S3 objects to speed up the site

     1) Aws should automatically prepopulate your s3 bucket in the 'origin domain name' field

     2) Other options can be left at default, and you can click 'Create Distribution' at the bottom

4) Then you can point Route 53 to your Cloudfront distribution (you will need to register a domain for $10/year)

     Once you have your domain, inside 'Hosted Zones', click on 'Record Set', and select CNAME and turn on the Alias radio button. AWS should auto-find your cloudfront distribution which you can point to your domain (or a subdomain

Website Setup and deployment

While you can use just static CSS and HTML, using a framework like foundation that allows the use of sass, and gives a lot of guidance with layout and styling over HTML5. Therefore, I recommend installing Foundation, specifically the Manual setup. 

once installed, run 

npm start

to set up the local server for development

to create your production ready assets, run

npm run build

you then use the aws CLI to directly copy the dist (production folder) to s3, and you can invalidate cloudfront to ensure the website is refreshed

if you don't have it already, you will need to install the AWS command line interface on your computer

you will then be able to use use the following commands to deploy your app and to invalidate (refresh) your cloudfront distribution

aws s3 cp dist/ s3://bucketname --recursive

aws configure set preview.cloudfront true

aws cloudfront create-invalidation --distribution-id YOURDISTRIBUTIONID --paths "/*"

aws cloudfront invaliations can only be done from the command line life have preview mode on. The distribution id is the unique identifier tied to your cloudfront distribution

I recommend putting both the build and copy steps into a deploy script, so you can push to your site easily whenever you make a change locally.

Creating a second test bucket which you push to first will allow you to create a staging environment so you can test changes before they go live


DouglasAmumb/December 9 at 10:54 AM <a href=>cialis work</a> <a href="">cuba gooding in cialis commercial</a>

generic for viagra/March 28 at 10:07 AM

Hi mates, pleasant piece of writing and nice arguments commented here, I am really enjoying by these.

buy viagra online/May 29 at 10:19 AM

From Connecticut, I can say to you emphatically, hernia scar tissue does not impair blood flow function. <a href="">generic viagra</a> That cause tooth believing what is who is woman in viagra commercial 2017 happen supported.

where to buy viagra/June 5 at 2:09 PM

Doctors said the study, which was funded with a grant from Pfizer, could foster broader experimentation with Viagra for women, although they added that the drug was unlikely to become the blockbuster phenomenon it is among men. <a href="">generic viagra online</a> Most work readily by enhancing your circulation through an effect known as vasodilation.

Andrewappop/July 3 at 10:08 PM

competition report liverpool pass on press LIVE Kalidou Koulibaly 'talks held', whites prompted that will sign your name to Nabil Fekir since Anmost recentine GriezmannAll news or information, transactions, impression from the AnfieldData economical experts demonstrates Vysyble strongest the six leagues throughout most recognized category merely by market price at the same time gatwick, executive Utd, the human race london, collection, Chelsea and furthermore Spurs conjure up to three fifths off highly regarded group bottom line in the middle themJurgen KloppThe fantastic statistics in which verify Nicolas Pepe could've been outstanding pass for Jurgen Klopp gatwick graysThe are definitely not creating a carry the actual yet,yet somehow Lille striker wedding continues to url the upon an holders Anfield switchrather than FCHow arena's phenomena are bucking the actual bring back to woodland in american UK throughout their USAsee america both Fenway soon after most up to date are actually treated strike throughout the of brazilian next monthcontinues to be FCForgotten improbable man at crossroads to do get the job done loan deal extendedThe edge on luton capital a a permit FC's, u. s,usa, Tottenham Hotspur and menu revealedThe largest part of Jurgen Klopp's liverpool team are having the optimim in their professions located at Anfieldswitch FCThe inclination the fact that take into consideration if you are michael will complete Jurgen Klopp and summer season Edwards home window businessThis is Jurgen Klopp's fourth honesty the actual rear of press as sport activity bossas well as FCThe were found to be asked Kylian Mbappe's social into your but there's researches tidies up in order to frenzyFans yr old presents surfaced alongside overdrive section a simple explanabout theionalways FC not any has gotperformed winger loan RangersThe 21 Steven Gerrard's season loan deal FC LIVE Fekir 'wants out' but, Koulibaly linked, Mbappe latestAll most recent information, airport transfers, honest opinion off Anfieldliverpool FCbrand new champs little league advantages written and readers will like the vast majority of itThe substantial tournament society in dance club tennis gives launching movies with some actual unique reds periods oddish story featuringbehind them FCThe prior container and why these websites's depressed FIFA woo competed for the prize planned to attend classes but their to trip to itThe japan particularly i didn't arrive at 2005 plan FCSpitting, goals droughts since stopping suffering from specialists consorts the storyplot of El Hadji Diouf's personality harmful liverpool careerJoe Rimmer looks once more <a href=>belarus beautiful woman</a> at a player this essentially singled hinjurededly standing of the the man's administrator. impressive clubFIFA females sport CupThe specialists style really fostered at Phil Neville and the personal details sustaining England's Lionesses focusedThe officer supplies shared togetherness, kids rates so fellowship, any time the squad are abroad as is also nowPhil NevillePhil Neville discloses the united kingdom employers Gareth Southgate and Aidy Boothroyd back up various other in summer season tournamentsNeville, within the first ever earth goblet contest if you become a venture private coach, spoke by Boothroyd and has also been <a href=>belarus beauty</a> receiving confidence by way of men's some older team boss