In this video, you will learn
1. How to Host a static website in AWS using S3 Bucket?
2. How to Configure DNS server using route 53 to connect your domain name with the static site.
Open AWS Console
Navigate to S3 under the Storage category. Here are zero buckets for now. Let’s create a new bucket to host the simple static website.
Go through Create Bucket.
Name the bucket name with your domain name like lokanthali.com
Next, select the Region US East (n. Virginia)
Another option is Bucket settings for block public access. Since we are hosting static site which must be all assessable through the front end, we have to make all pages and resources publicly accessible otherwise it won’t open.
Uncheck the checkbox which says block all public access.
Navigate to the upload button and click on it.
In the popup, you will see 4 septs
1. Select File
2. Set Permissions
3. Set Properties
And last review
Check the Use this bucket to host a website option.
Now you need to define the homepage file name, error page file name like
Index.html is our page whereas error.html is our error page. Save it.
Good Job, It’s working fine.
Number 1. Select the s3 bucket policy.
Second: effect Allow ok
Principal: we are allowing all files and folders to the public access so type * Actions: we don’t allow all actions to the public like delete so that here we only allow get object action so that the public can view but can’t edit and delete the files.
Another option is ARN which is Amazon Resource Name. It is for, identifying for which bucket this policy is for. We can copy the ARN from the previous page.
Just paste it. Note that, here is missing the key name so add / * which means for all files.
Copy the JSON code and paste on the previous page and save it.
Great the site is working fine.
Now for the domain name mapping to this hosting, we need further one more step that is configuring route 53.
Search route 53 and open it.
In DNS management, click in create hosted zone.
Click on create Hosted Zone
Type the domain name the same of bucket name in our case, it lokanthali.com
Click on the create button.
Now we need to map in between these route 53 DNS and S3 which we have upload our files.
For that, click on Create Record Set,
In Name you can leave it empty.
Now Check Yes for the Alias where you will get Alias Target in the dropdown.
Find S3 Website Endpoints where your hosting is listed over there. Select it.
Note that if you do not follow the DNS-compliant naming conventions mean if you choose a bucket name other than your domain name, it will not appear in the dropdown.
You can see the DNS name server which you need to place in the domain name.
Copy the DNS name servers and configure them in the domain name.
Now your site ready which can view from worldwide.
What if someone type www. In front of your domain name. Oops it will not work.
It’s very simple to solve this issue. Navigate to S3 again and create a new bucket with including www. In front of your bucket name as www.lokanthali.com
Choose the region and make it bucket public as we did before.
Ok new bucket is created successfully. Now here are two buckets one without www. Whereas another with www. In front of the domain name.
Now what we are going to do is, redirecting www to without www
So that if the user hit www. Including or excluding, our site will always open from without www. Name bucket.
Again navigate to Properties and click in static web hosting. This time check on Redirect requests
Place the target domain to the previous bucket name which is without www. In Domain name.
In the protocol, simply type Http for now.
Now another one more step to do which is configuring the DNS server in route 53.
Navigate to Route 53 again and click in the same domain name which we had added before.
We have to add another recordset. This time, in name, insert www and check Alias yes as before. In Alias Target dropdown list, select s3 website endpoints with www. Domain name. and click create.
Now let’s try in the browser.
Great, it works fine now with www. and without www as well.
In this way you can create s3 buckets and configure DNS using route 53 and connect your domain name with your s3 bucket and host the static site in AWS.
SUBSCRIBE to our YouTube channel for more videos:
Like us on Facebook:
For more content go to
E-mail: [email protected]