πŸ”° Creating High Availability Architecture with AWS CLI πŸ”°

Dileepkumar
4 min readOct 30, 2020

In this article we gonna integrate AWS instance, EBS, S3 (STORAGE), Cloud Front all together and configure the Web server

βœ… Here we launched a new instance upon AWS.

CODE: aws ec2 run-instances β€” image-id ami-0e306788ff2473ccb β€” instance-type t2.micro β€” count 1 β€” subnet-id subnet-e5676e8d β€” security-group-ids sg-02dd8e7bfe5ad94e0 β€” key-name awsclass2020key
Info of our instance

Check in aws also β†’ instance launched (aws-cli-arth)

instance lauched

βœ… [Now lets configure the webserver on our instance. For that lets install httpd in our instance

Command: yum install httpd

Now lets check the status of httpd

cmd: systemctl status httpd

As it is inactive lets start the httpd

now it is active

Finally we have configured apache webserver in our instance

βœ… Now lets create EBS volume

command: aws ec2 create-volume β€” availability-zone ap-south-1a β€” size 1
This is our instance storage /dev/xvda β†’ is our root storage

Attach the EBS volume to the instance

COMMAND: aws ec2 attach-volume β€” volume-id vol-0263566aa0ce0f421 β€” instance-id i-0fc29c030cd1b9465 β€” device /dev/sdf

Now check in AWS console

Here u can see EBS volume has been attached

βœ… Now lets create Partition for the new attached volume

Here # fdisk /dev/xvdf β†’ to go inside it and β€˜ n’ to create new partition and β€˜p’ to make a primary partition .Finally β€˜w’ to save it

βœ… Now format it

Formatted ext4 is a one type of inode table

Now lets mount the device to the /var/www/html β†’ becoz to make it availble for the webserver β†’ root document (/var/www/html) for webserver

βœ… Now create a web page in the /var/www/html folder

βœ… Now lets create S3 bucket to save the static files.

command: aws s3api create-bucket β€” bucket dileep142 β€” region ap-south-1 β€” create-bucket-configuration LocationConstraint=ap-south-1

You can check in aws GUI it is created.

Now u can upload any of ur pic in the bucket so that it will be visible in the website.

copy the url provided by the S3 and make it public

Now paste this url in ur HTML file created in the /var/www/html

Now finally lets create cloudfront distribution.

Which helps our website to be very fast and make user satisfaction.

created distribution

βœ…Now we can check weather our instance configured with webserver or not by searching http://<ip>/<html file name>

By the help cloudfront our website will be very fast (low latency) and will be available for anyone in the world with the same speed(velocity)

@HIGH AVAILABILITY ARCHITECTURE

⏩ By this we finally done the Task-6

THANK YOU

--

--