Host a Static website on EC2 using Route 53 with 3rd party domain

  1. EC2
  2. ELB & ASG
  3. Route 53

Creating Zip file

The folder which contains website files including index.html is to be zipped and uploaded to the s3 bucket. so our first task is to zip the website folder

Uploading files to S3

  1. Go to S3 Console
  2. Create Bucket ( give it any name and the rest of it as it is)
  3. Click on the bucket which we have created => Click on upload => Click on Add files => choose zip file => Click on upload

Creating Auto Scaling Group

  1. Go to EC2 Console
  2. Click on ‘Auto Scaling Groups’
  3. Click on ‘Create Auto Scaling Group’
  4. Give any name to ASG and right click on ‘create a launch template’ and open in new tab
  5. Enter details below:
(select existing key pair or create new key pair)
select security group having inbound SSH and HTTP rules - if don't have then create one
# Use this for your user data (script from top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
cd /var/www/html
aws s3 cp s3://whatistime/ /var/www/html/
mv website/* .
service httpd start

Domain Register

Now we want to register a domain

  1. Go to website and sign in[create an account if you don't have]
  2. Click on services => register a new domain
  3. Enter domain name want and click on check availability

Connect domain with Route 53

Now it’s time to connect our instances with our domain.

  1. Go to route 53 and click on create hosted zones

Route 53

Now we are in final step



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store