High Availability Architecture with AWS CLI

Dhruv Upadhyay
3 min readSep 6, 2022

--

The architecture includes-

- Webserver configured on EC2 Instance

- Document Root(/var/www/html) made persistent by mounting on EBS Block Device.

- Static objects used in code, such as pictures stored in S3

- Setting up Content Delivery Network using CloudFront and using the origin domain as an S3 bucket.

  • Finally, place the Cloud Front URL on the webapp code for security and low latency.

Step 1: Run an instance on the AWS using the windows command line

Step 2: upload some images to the AWS for hosting purposes through the EBS volume only.

Now here we have made a basic code for the HTML which we are hosting in EBS volume which is not as secure as the S3. So now will copy our object i.e. the image here in the s3 bucket.

Step 3: steps to create an S3 bucket

Here is the proof of the creation of the S3 bucket.

Uploading the photo to the s3 bucket

Now we would update the code to the source of s3

S3 is secure, but it will be slow if the request is from far where the edge location is different from the client.
So, now the solution is to load the object on the CloudFront where the cache of objects is loaded onto different edge locations to provide faster access.

So, now we would configure the CloudFront

Here is confirmation of the CloudFront distribution created through the CLI

So now we would update the HTML code to provide the CloudFront source in the code.

Now here is the final result, we have finally created a webserver on the AWS

--

--