Hosting websites on VPS Server has been fun, but after a while you get tired of all the maintenance and security that has to be done.
I have been using Amazon S3 for backups of websites and I couldn't believe how inexpensive the service was. So now I am hosting some static websites on Amazon. It is easy, inexpensive, secure and the service can grow with your websites traffic.
So I will show how it was done and what services are connected to it.
Do you have an account with Amazon? If not you can get it HERE or just go to http://www.amazon.com.
So lets say you have a static website already.
Go to Amazon and login into your AWS Management Console. So you are logged in. Lets create a S3 Bucket for the website.
Click on S3
Click on Create Bucket, enter Bucket Name and choose Region, click on Create.
Click on the left of the new Bucket you have created. Under Static Website Hosting, make sure that Enable website hosting is checked of and enter index.html under Index Document:
Now Amazon is ready for your static website. You can use the web page interface to upload your website.
Click on your bucket.
Actions > Upload and Drag and drop files and folders to upload here. Then click on Start Upload.
Once everything is uploaded.
Click on the left of the files that were upload, Actions and Click on Make Public.
Now go to Properties > Static Website Hosting and click on the website on the right of Endpoint:
You should now see your new website.
Now I will show you some better ways to upload your website, because every time you upload you website with the web browser you will need to set Make Public.
First you will need to install the Amazon s3 tools. Go to https://aws.amazon.com/cli/
Download the version you need for your Operating System.
Check out the installation documentation.
Installation on Mac.
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"$
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Test aws command line tool.
This is the script I use on my Mac. This script will sync the file to Amazon, set the files for public read and exclude the DS_Store file from getting uploaded.
$ vi scriptname.sh enter information below.
echo "Updating www.domain.com website"
aws s3 sync . s3://www.domain.com --acl public-read --exclude '*.DS_Store'
Then all you need to do is run your script after making changes to you website.
./scriptname.sh hit enter key.
Services that can be used with Static websites. This link has a lot of resources to choose from.
Other Services I used.