High Availability Architecture with AWS CLI

Jayesh Kumar
Nov 2, 2020

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 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 image 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 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 object is loaded onto different edge locations to provide faster access.

So, now we would configure the CloudFront

>aws cloudfront create-distribution help

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

--

--