Creating High Availability Architecture with AWS CLI

Deeksha Gautam
5 min readMar 18, 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 CloudFront and using the origin domain as S3 bucket.

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

AWS

Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform. Millions of customers — including the growing startups, largest enterprises, and leading government agencies are using AWS to lower their infrastructure costs, become more agile, and innovate faster.

AWS CLI

The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, we can control multiple AWS services from the command line and automate them through scripts.

AWS EC2

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment.

AWS EBS

Amazon Elastic Block Store (EBS) is an easy to use, high-performance, block-storage service designed for use with Amazon Elastic Compute Cloud (EC2) for both throughput and transaction intensive workloads at any scale.

AWS CloudFront

Amazon CloudFront is a fast content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to customers globally with low latency, high transfer speeds, all within a developer-friendly environment.

Apache Webserver

Apache HTTP Server is a free and open-source web server that delivers web content through the internet.

PRE-REQUISITES:

i) Download the AWS-CLI(64-bit)
Following is the link to download the software: https://awscli.amazonaws.com/AWSCLIV2.msi
ii) Get the details like ‘Access key Id’, ‘Secret access key’ by creating an IAM user with ‘PowerUserAccess’ managed policy and providing tag.

Now, Let’s start with the practical implementation :-

Step-1: Firstly login to AWS using command line with the command “ aws configure “. To login , we will use Access key and Secret key provided by AWS IAM service.

Logging in to aws-cli

Step-2:- Create key Pairs and provide unique name

Created key pair
Key-pair at AWS console

Step-3:- Create Security Group for the instance

Created security-group
Security-group at AWS console

Step-4:- Launch an instance by attaching the security group and key-pairs created in previous steps

Launched the instance
Instance at AWS console

It’s a good practice to add some tags to the instance, as it becomes easier to filter.

Added tag to the instance
Successfully added tag to the instance

Step-5:- Create an EBS volume of 1GB

EBS vol. created
EBS volume at AWS console

Step-6:- Attach the EBS volume to the instance.

Attached the volume
Confirming at AWS console

Step-7:- Login remotely to the instance and configure webserver i.e. firstly install httpd

Installed httpd

Step-8:- Check the status of the webserver

Step-9:- Check the status the of the disks attached with instance

Step-10:- Create partition of 1GB and check it with “ lsblk” command

Successfully created partition

Step-11:- Format the partition

Successfully formatted

Step-12:- Mount the Drive/Partition with Mount Point(/var/www/html).

Mounted the partition

Step-13:- Create S3 bucket and make the bucket public

Created S3 bucket
S3 bucket at AWS console

Step-14:- Upload an image in s3 bucket and make it available for public access.

Added object to our bucket

Step-15:- Create CloudFront and attach with the s3 bucket to access the content of bucket using Content Delivery Network (CDN) using the url.

Created cloudfront distribution
CF at AWS console

Step-16:- Start the webserver and check it’s status

Status of the server should be active

Step-17:- Now we can access the web page using the Public IP of Instance via browser

Yayy !! Successfully done with our goal!!

Thank you for reading !!

--

--

No responses yet