Task6:- High Availability Architecture with AWS CLI

AmanGoyal
4 min readMar 25, 2021

Task Descriptionđź“„

đź”° Create High Availability Architecture with AWS CLI đź”°

đź”…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 Cloud Front and using the origin domain as S3 bucket.
  • Finally place the Cloud Front URL on the WebApp code for security and low latency.

First let see some basic terminology which will be use here.

Amazon S3 Bucket:-
Amazon S3 has various features you can use to organize and manage your data in ways that support specific use cases, enable cost efficiencies, enforce security, and meet compliance requirements. Data is stored as objects within resources called “buckets”, and a single object can be up to 5 terabytes in size.

Amazon CloudFront Distribution:-
* Amazon CloudFront is a content delivery network offered by Amazon Web Services. Content delivery networks provide a globally-distributed network of proxy servers which cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.

  • AWS Cloudfront service provides a private network to transfer data files & Edge location to store local caches temporary ( For some time period only ).

For this task we will use previously created instance which is described in below given article . Task3:- AWS Instance Set up with CLI

So in this article we will directly start from setting up web server .

For this we will login to our launched os. then we will run following commands for setting up web server . put website content in home.html file

sudo su — root
yum install httpd
cd /var/www/html
vim home.html
setenforce 0
systemctl start service
systemctl enable service

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

for this we will use following commands

fdisk -l
fdisk /dev/xvdf
mkfs.ext4 /dev/xvdf1
mount /dev/xvdf1 /var/www/html

Now Create S3 Storage

aws s3api create-bucket — bucket aman-arth-bucket — region ap-south-1 — create-bucket-configuration LocationConstraint=ap-south-1

Upload a image & Give Public Permission

aws s3 cp C:\Users\admin\Desktop\aman.jpg s3://aman-arth-bucket/ — acl public-read

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

aws cloudfront create-distribution — origin-domain-name aman-arth-bucket.s3.amazonaws.com — default-root-object aman.jpg

Now we got CloudFront url SO place the Cloud Front URL on the webapp code for security and low latency -

<H1> Hello World </H1><Br>
This is my first page<Br>
<img src=https://d1i4khqqpa4p5y.cloudfront.net width=500 height=400>

now use public ip for web page .

That’s all with this article. I hope you found the post Informative, if something was missing or you think some more things could have been added, feel free to provide suggestions in the comments section.

You can check out my LinkedIn profile.

Also you can check out my GitHub profile.

Thanks for giving your precious time to this article✌ Hope you like it if you like please clap for it.:-)

--

--