Create High Availability Architecture with AWS CLI

Ritik Bobade
Oct 29, 2020

1.Webserver configured on EC2 Instance

· Launch a Ec2- instance.

· Now install httpd service on it by running command “ yum install httpd “

· Start the service by command “ systemctl start httpd”

· Now as we are using AWS we don’t need to stop the firewall or configure it.

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

· Create A EBS Volume by running command

aws ec2 create-volume \
> — volume-type gp2 \
> — size 1 \
> — availability-zone ap-south-1a

· Attaching the volume to the above launched instance by running command

ws ec2 attach-volume \
> — volume-id <volume-id>
> — instance-id <instance-id>
> — device /dev/xvdh

· Now we have to mount the attached storage to the /var/www/html

For this run command

mount /dev/(disk name) /var/www/html

3.Now Create a S3 Bucket

· Add static images or files that are to be hosted in the bucket.

· Make the bucket and its contents public.

4.Replace the URL of images with the Desired URL in the S3 bucket in the html file.

5.Set the Cloud Front for this bucket

· Go to Cloud Front and create distributions.

· Select the desired bucket and configurations.

· Now we can use domain name in place of desired content of S3 bucket .

This will load your data faster as compared to earlier.

--

--