AWS : Beginner series : Step by Step # Static website hosting on S3

Preet Sharma
4 min readJun 14, 2020

Objective of this article is to provide step by step instructions to host your website using AWS resource for public access. It covers Website uploading to S3, Config S3 as static website hosting endpoint, Register your website domain name with Route53, setup name servers to make your site available publicly.

As mentioned above below are the tasks with setup process to active this objective.

a. Create your website (I will provide sample one pager html for test)

b. Create S3 bucket and upload your website

c. Setup S3 for website hosting

d. Register new domain (if you don’t have and want to give custom name to your website)

e. Setup name servers

Pre-requites:

- You must have active aws user account. If not create your free account (https://aws.amazon.com/free/)

  • (Optional) as per security best practice , we shouldn’t use root account for any activity. We should create one user account profile with Admin as an administration to manage all other accounts and profile.
  • (optional) if IAM user is not Admin then grant required permission to the user.

So first thing first and one step at a time.

A) Create your website # You can build your complete website or just for learning purpose you can create single html page as well as explained below :

Save above text file as “index.html” (remember the name all small/CAP/Init)

B) Create S3 bucket and upload your website # below are the steps for S3 bucket creation

a. Login to the https://console.aws.amazon.com/ using your user credential.

b. Select S3 from service drop down menu (Top-left side)

c. Click on create bucket, Give Bucket name ,Region where you want to deploy the bucket (closer to your website user) , Uncheck Block all public access checkbox as we have to make it public. Finally click on the create bucket.

d. Bucket will be created and you can see that in the bucket list. Click on the bucket name hyperlink and it will open bucket setup wizards with multiple frames. First upload the index.html file.

C) Setup S3 for website hosting# once file is uploaded and appear in the list of “Overview” frame. This is just an object file and NOT a website yet. So time to setup as a website.

a. Click on the next frame “Properties” and you can see “Static website hosting” tile. Click on the tile and setup as below. Select radio button(Use this bucket to host a website)

b. Enter name “index.html” as name of the index document/home page(case sensitive).

c. Note down the Endpoint which is on the top of property popup.(ex. http://thebeautifulworld.com.s3-website.ap-south-1.amazonaws.com)

d. Save the configuration.

e. Click on the frame “Permissions”. And open Bucket policy setup by clicking on Bucket policy.

D) That’s it ! Now website is ready for public user access. Please note, this website hosted on http only and not on https. To access the website open you browser and enter the name as per S3 website endpoint (i.e. http://thebeautifulworld.com.s3-website.ap-south-1.amazonaws.com/)

[Optional]

E) Register new domain (if you don’t have and want to give custom name to your website) : as mentioned above website name is http://thebeautifulworld.com.s3-website.ap-south-1.amazonaws.com/ . If we want to change the website name (Domain name) to http://thebeautiful.com then we need to use route53 service and setup as per below :

a. Open route53 and register the domain. Please note it is chargeable on annual basis (minimum). Once domain is active it will appear under registered domain name. Once active then follow the next steps:

i. Click on the registered domain name and click “add or edit” Name servers configurations by adding name servers. Below are few of the NS used by AWS.

ii. Now just last step, Top left side click “Hosted zone”. It will open NS configuration record in the hosted zone for the respective domain. Two record sets are already configured with NS and SOA types.

iii. To add new record set for our S3 website to map with the domain name, click on create record set, select Alias as Yes and your S3-bucket as Alias target. Save the changes and that’s it. Website is publicly accessible.

To test the website, open browser and type http://thebeautifulworld.com. Please comment in case of any query. I will try my best to respond ASAP.

--

--