Learn how to deploy a Static Website on AWS!
Objectives:
By the end of this article, you will be able to:
- Understand the concept of Static Website & AWS
- Host a static website on AWS
Let’s see the final output (website hosted on AWS): http://ankitproject.link
Firstly, what is a Static Website?
A static website is delivered to a user exactly the way it’s stored. That means that nothing on the page will change by the user or even the site administrator unless there’s a redesign of the site, or the site administrator goes directly into the code to change it.
Secondly, What is AWS?
Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 200 fully featured services from data centers globally. Millions of customers — including the fastest-growing startups, largest enterprises, and leading government agencies — are using AWS to lower costs, become more agile, and innovate faster.
Steps to host a static website on AWS?
STEP 1: Create a Custom Domain Name using Amazon Route 53
Note: AWS may take up to 3 days to register a domain. But, it’s usually done within 10 minutes
STEP 2:
- Use an Amazon S3 Bucket to host a sample website
- Upload the HTML code to the S3 Bucket
- Make sure the S3 Bucket Name is the same as the Domain Name created in Step 1
- Make sure that the S3 Bucket is enabled for Static Website Hosting
- Edit the S3 Bucket Policy
STEP 3:
- Enable static website hosting and direct the domain to the S3 Bucket
- Go to Amazon Route 53
- Click on Hosted Zone under DNS Management
- Click on the domain name created for this project
- Click on Create Record to point the S3 Bucket to our custom domain name
That’s it! Just click on the link of your website hosted on AWS: http://ankitproject.link
NOTE:
Here’s the HTML Code used in this project:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>My Website Home Page</title>
</head>
<body>
<h1>Welcome to my website</h1>
<p>Now hosted on Amazon S3!</p>
</body>
</html>