🔰 Create High Availability Architecture with AWS CLI 🔰

Ashutosh Rai
5 min readSep 15, 2021

--

🔅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.

Let’s create this high availability architecture step by step using AWS CLI :-

STEP-1 :- Webserver configured on EC2 Instance

Below are the images in which we have created security groups, key pair and then with the help of this security group and key pair we have launched the EC2 instance(Singapore) :-

To create key pair :-

To create Security group:-

To launch EC2 Instance:-

To configure webserver on EC2 instance and to start the service :-

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

Below are the images in which we have created the EBS volume and then we attach this EBS volume to EC2 instance using AWS CLI commands and then we created filesystem and mount this EBS volume with document root :-

To create EBS volume :-

To attach this EBS volume to EC2 instance :-

To check EBS volume is successfully attached to EC2 instance or not and to create the filesystem for this new EBS volume :-

To mount this EBS volume to document root of web server :-

STEP-3 :- Static objects used in code such as pictures stored in S3

In this step we have created S3 bucket, uploaded the object in this bucket from local system and then we make this bucket and object public by applying/giving some permission :-

To create bucket :-

To upload object from local system into the bucket :-

To make bucket and object public :-

Now go to browser and search with Object URL, you will see your object because you make this object public :-

STEP-4 :- Setting up Content Delivery Network using CloudFront service and using the origin domain as S3 bucket.

In this step, we have created distribution using the domain name as S3 bucket :-

To create the cloudfront distribution using the domain name as S3 bucket :-

Now go to browser and search with domain name(d3ggjevc1qn8gy.cloudfront.net/object_name) provided by the cloudfront distribution, you will see that you will be automatically landed to the object URL with low latency :-

STEP-5 :- Finally place the Cloud Front URL on the webapp code for security and low latency.

In this step, we have created webpage and in this webpage we have provided the cloudfront distribution URL in the code for security and low latency.

Now go to browser and search with public IP of your instance, you will see your webpage with security and low latency.

Please tell me or connect if this article is really help you and further article will be post as soon as possible. Keep sharing, keep learning. Have a nice day.

Connect with me on LinkedIN :- www.linkedin.com/in/ashutoshraii

#aws #awscloud #awscsa #arthbylw
#vimaldaga #righteducation
#educationredefine #rightmentor
#worldrecordholder #ARTH #linuxworld
#makingindiafutureready #righeudcation

--

--

Ashutosh Rai
Ashutosh Rai

Written by Ashutosh Rai

0 Followers

Nothing is impossible

No responses yet