Websites are important for any business. Gone are the days where you need a computer and dial up connection for getting connected to the Internet and browse the ever expanding catalog of all websites/pages/resources that are spread across the globe. Internet, being global and is available in most of our hands today. Thanks to the global network connectivity and mobile computing that made this possible.
People across the globe are searching for services and products online. The ratio of people searching for products and services online to people searching physically is growing exponentially on a daily basis.
Every business needs a website for online presence and everyone is looking to have a website either to create a profile for themselves or write a blog on their area of interest. You can use profile services such as Facebook or blogging services such as Blogger but remember you are hosting your data in 3rd party servers and you have less administration capability at infrastructure level.
If you are a geek and you want to host your own data, you got to sign up for following services and be prepared to spend a few bucks for the luxury of hosting your data yourself. Sign up for Amazon Web Services (AWS), a Domain Name System (DNS) provider like dnsmadeeasy, optionally you can also sign up for cloud flare for securing your website.
S3(Simple Storage Service) hosting will cost you less than $1 a month provided you are not driving too much traffic and not hosting a size heavy website. Pls refer to AWS pricing (is there an online lookup site we can link to) for more details. If you are very specific about the cost factor, go to AWS billing and set up a notification trigger that will send you a notification when you cross a threshold (may be > $1 in this case) so you know when you hit your budget limits.
Here is a step by step procedure for hosting your website on AWS S3
- Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
- In S3 console, create a bucket – choose the region that's close to the website consumption
- Open the bucket Properties panel, click Static Website Hosting, and do the following:
- Select the Enable website hosting
- In the Index Document box, add the name of your index document. This name is typically index.html
- Click Save to save the website configuration
- Note down the Endpoint
The bucket name should be same as your URL. For example if your website URL is going to be www.thisismysite.com then your bucket name will be www.thisismysite.com
This is the Amazon S3-provided website endpoint for your bucket. You will use this endpoint in the following steps to test your website.
To add a bucket policy that makes your bucket content publicly available
- In bucket Properties panel, click the Permissions
- First give list and read permission to everyone so that everyone can access the website
- Click Add Bucket Policy
Copy the following bucket policy, and then paste it in the Bucket Policy Editor
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadForGetBucketObjects",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::www.thisismysite.com/*"
]
}
]
}
- In the policy, replace www.thisismysite.com with the name of your bucket
- Click Save
All these steps should be followed before you upload the index.html to your bucket or create other subfolders in your bucket. The reason for that is to ensure that all your permissions are synchronized to the index.html and other sub folders under the bucket.
To upload an index document
- Create a document. The file name must be same as the name that you provided for the index document earlier
- Using the console, upload the index document to your bucket. For instructions, go to Uploading Objects into Amazon S3 in the Amazon Simple Storage Service Console User Guide
Test your website
- Click on the endpoint – under properties of the bucket. The endpoint will be something like http://www.thisismysite.com.s3-website-region.amazonaws.com If your browser displays your index.html page, the website was successfully deployed.
Note:
- HTTPS access to the website is not supported
- You now have a website hosted on Amazon S3. This website is available at the Amazon S3 website endpoint
- Next you have to procure your domain and perform DNS cut over for your website
- Signup for any DNS service of your convenience like www.godaddy.com or www.dnsmadeeasy.com
- Create a CName record in DNS to point the required URL to S3 endpoint
Recap:
- Create bucket using the naming standards
- Enable static hosting and give the index file name in S3 properties
- Give necessary permission for everyone in the S3 bucket
- Add S3 bucket policy as appropriate
- Upload the index file
- Go to the endpoint and check if the website is loading
- Add CName record in your DNS so yourdomain.com points to the S3 endpoint
- You may have issues with root domain, in that case use redirection service for redirecting www traffic to http://yourdomain.com