High-Availability Infrastructure setup on AWS using AWS CLI

Ankit Pramanik
AWS in Plain English
3 min readMar 16, 2021

--

Here we will be creating a High Availability Infrastructure setup using AWS Cloudfront, with origin from AWS S3 integrated on to a website hosted on AWS EC-2.

For this setup, we will be doing the complete setup using AWS CLI.

The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

First we will create an EC-2 instance where the website will be hosted:

Now, we will be installing Apache httpd webserver on our instance which we created:

Installing httpd server
Starting the httpd server

Creating EBS Volumes and attaching to EC2 Instance

Created EBS Volumes and added tags to it.
Attaching the EBS Volume to the created instance.

Creating partitions, formatting and mounting the new drive to the required destination

Creating Partitions
Here we can see a partition of 2Gb created
Formatting using mkfs.ect4 and finally attaching to the required location

Creating S3 bucket and uploading images to S3 bucket:

Created S3 Bucket
Uploading image to s3

Now that we have created the bucket and uploaded a sample image to the bucket. It’s time we create a simple website using HTML5 and deploy it onto our webserver that we created.

Created Cloudfront Distribution for the bucket we created
Our website up and running

Summary

So now that our website has been deployed, let’s take a brief look at what we have done.

We created an EC2 instance which we have used as a webserver and installed Apache httpd webserver onto it.

We created an external EBS volume and attached it to our EC2, we have done this because, when we delete an instance, the volume attached to it is also deleted. In order to make our code permanent, we attached another external volume and attached it to the required folder.

We created our S3 bucket and uploaded our image onto it.

We created a cloudfront distribution so that the data can be stored in multiple edge locations.

We created a simple website with the fqdn(fully qualified domain name) we got from the cloudfront distribution and used it in our website.

--

--