High Availability Architecture with AWS CLIv2


Problem Statement:

Step-1) Install AWS CLI and configure it.

AWS CL Installed.

Step-2)Create a key pair

aws ec2 create-key-pair --key-name KEY_NAME > OUTPUT.pem

output :

Step-3)Create a security group

aws ec2 create-security-group --group-name GROUP_NAME --description "DESCRIPTION" > OUTPUT.TXT


security group.

Step-4)Launch an instance using the above created key pair and security group.

aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --count 1 --subnet-id subnet-1105675d --security-group-ids sg-040c982abe9bb3d48 --key-name key2 > ec2inf.txt


aws ec2 launch.

Step-5)Create an EBS volume of 1 GB.

aws ec2 create-volume  --volume-type TYPE--size 1 --availability-zone ZONE_YOU_WANT > OUPTUT.TXT


Step-6)Attach the above created EBS volume to the instance you created in the previous steps.

aws ec2 attach-volume  --instance-id YOUR_INSTANCE_ID --volume-id VOL_ID --device /dev/sdf

Output :

Step-7)Create partition , format it and mount on /var/www/html

fdisk -l
fdisk /dev/xvdf
partioning+ formatting
mkfs.ext4 /dev/xvdf
mount /dev/xvdf /varw/www/html
mounted on /var/www/html.

Step-7)Create an S3 bucket for static content

aws s3 mb s3://bucketname


Step-8) Upload content in the S3 bucket

aws s3 cp . s3://BUCKET_NAME --recursive --acl public-read

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

aws cloudfront create-distribution --origin-domain-name BUCKET_NAME.s3.amazonaws.com



Step-10) Place the Cloud Front URL on the web app code for security and low latency.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himanshu singh

self learner ! Engineer ! dedication to learn new skills