Creating High Availability Architecture with AWS CLI

Srinivasreddy
4 min readNov 3, 2020

Hello connections this is my task 6 under arth program,in this blog i’m going to create high availability architecture with aws cli.

🔰 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 CloudFront and using the origin domain as S3 bucket.

  • Finally place the Cloud Front URL on the webapp code for security and low latency.

Creating key pair:

aws ec2 create-key-pair -- key-name task6

Creating security group:

aws ec2 create-security-group group-name description task6sg

creating ingress rules for security groups:

aws ec2 authorize-group-ingress protocol tcp group-id < > -cidr 0.0.0.0/0`

Creating and running instances:

aws ec2 run-instances image-id < > instance-type t2.micro key-name task6 security-group-ids < > count 1 subnet-id < >`

Creating volume with storage 10G:

aws ec2 create-volume availability-zone ap-south-1b volume-type gp2 size 10`

Attaching volume to instance:

aws ec2 attach-volume instance-id < > volume-id < > device /dev/xvdf`

Creating partition:

fdisk /dev/xvdf`

Formatting the partition:

mkfs.ext4 /dev/xvdf1`

Installing httpd and starting services:

yum install httpd`

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

mount /dev/xvdf1 /var/www/html`

Creating Bucket:

aws s3api create-bucket bucket < > create-bucket-configuration LocalConstaint=ap-south-1 — acl public-read`

Uploading images to s3 bucket:

aws s3 cp <local directory file> -acl public-read`

Creating Cloudfront:

aws cloudfront create-distribution origin-domain-name saitej143212.s3.amazon.com`

creating html file with extension .html:

<h1> hello</h1>

<img src=”< link >” width=”500" height=”500" />

This is the image i uploaded to bucket.

🌟Thank you…. 💫 💫

--

--