S3 is a cheap way to host static files and pretty easy too (when you know how to do it)
What you need to have in order to do it:
- AWS account, you can get one through GitHub education > AWS education to get free credit
- Travis account (pretty straightforward, just log in with your GitHub account to create it)
- 10 minutes
Okey, you're all set. Let's go.
- Create a new S3 bucket and from the x > x view set its "Website Static Hosting" to yes with
index.htmlas the main file - Add this to your Bucket Policy > code
- Create a new IAM policy to allow Travis to push your code to S3. You can call it
DumbPolicyand then paste this to the policy editor replaceing BUCKETNAME with your bucket's name > code - Create a new IAM group and attach
DumbPolicyto it - Create a new IAM user to that group and copy and paste its Account Id and Account Secret to somewhere safe
- Next create a new repository in GitHub
- Clone the repository and create a file called
index.htmlto the root of it with this code > code - Create
.travis.ymland you can paste this to bootstrap it (those email notifications are seriously annoying) > code - Next you need to install travis gem using ruby >2.0 (you can check its specs from here(link)) using
gem install travis - Go to the root of the repository with terminal and enter
travis setup s3(here's the link to the travis' guide()) - Paste the Account ID and Secret that you copied previously
git add -Aandgit commityour stuff and push it to GitHub (remember to have your repository switch set to build from Travis options!)- After a short while Travis should build and copy your project to S3, incase something went wrong complain to me or consult the internet
- Go to AWS S3 console and follow the link to your S3 folder (eg. (example))
- You should see your amazing website! Truly a masterpiece