CREATE HIGH AVAILABILITY ARCHITECTURE WITH AWS CLI

suman15
6 min readNov 16, 2020

WHAT IS 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, you can control multiple AWS services from the command line and automate them through scripts.

The AWS CLI v2 offers several new features including improved installers, new configuration options such as AWS Single Sign-On (SSO), and various interactive features.

Prerequisites:

Install AWS CLIv2 in OS.

Configure AWS CLIv2 with IAM user.

Task Description :

The architecture includes-
1. Webserver configured on EC2 Instance
2. Document Root(/var/www/html) made persistent by mounting on EBS Block Device.
3.Static objects used in code such as pictures stored in S3
4.Setting up Content Delivery Network using Cloud Front and using the origin domain as S3 bucket.
5.Finally place the Cloud Front URL on the web app code for security and low latency.

LETS START!!

WHAT IS KEY PAIR?

A key pair, consisting of a private key and a public key, is a set of security credentials that you use to prove your identity when connecting to an instance. Amazon EC2 stores the public key, and you store the private key. You use the private key, instead of a password, to securely access your instances. Anyone who possesses your private keys can connect to your instances, so it’s important that you store your private keys in a secure place.

→ Create a key-pair

WHAT IS EC2 INSTANCE?

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. Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment.

→ Launch EC2 Instance

WHAT IS EBS VOLUME?

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. A broad range of workloads, such as relational and non-relational databases, enterprise applications, containerized applications, big data analytics engines, file systems, and media workflows are widely deployed on Amazon EBS.

→ Create an EBS Volume of 4 GB and Attach it to EC2 Instance

→ Attaching EBS to EC2 instance

WHAT IS WEBSERVER?

Web server is a computer that runs websites. It’s a computer program that distributes web pages as they are requisitioned. The basic objective of the web server is to store, process and deliver web pages to the users. This intercommunication is done using Hypertext Transfer Protocol (HTTP). These web pages are mostly static content that includes HTML documents, images, style sheets, test etc. Apart from HTTP, a web server also supports SMTP (Simple Mail transfer Protocol) and FTP (File Transfer Protocol) protocol for emailing and for file transfer and storage.

→ Installation of httpd and Starting Web Server

# yum install httpd -y

→ Creating Partition with AWS CLI

For better understanding refer to these two videos: 1.https://www.youtube.com/watch?v=awaNgkMYLTE&t=60s

2. https://www.youtube.com/watch?v=GnQUuxh7QO8

→ Formatting the Partition

mkfs.ext4 /dev/xvdf1

→ Mount the /var/www/html on EBS Volume

mount /dev/xvdf1 /var/www/html

WHAT IS S3 BUCKET?

An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services’ (AWS) Simple Storage Service (S3), an object storage offering. Amazon S3 buckets, which are similar to file folders, store objects, which consist of data and its descriptive metadata.

→ Creation of S3 Bucket :

→ Uploading the image to the bucket:

WEBSERVER CONFIGURED!!

WHAT IS CLOUD FRONT DISTRIBUTION?

Amazon Cloud Front is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .js, and image files, to your users. Cloud Front delivers your content through a worldwide network of data centers called edge locations. When a user requests content that you’re serving with Cloud Front, the user is routed to the edge location that provides the lowest latency (time delay), so that content is delivered with the best possible performance. If the content is already in the edge location with the lowest latency, Cloud Front delivers it immediately. If the content is not in that edge location, Cloud Front retrieves it from an origin that you’ve defined — such as an Amazon S3 bucket, a Media Package channel, or an HTTP server (for example, a web server) that you have identified as the source for the definitive version of your content.

→ Creation of Cloud front distribution

→ Put the domain name of Cloud front and Image name in image source in html Code (task.html)

TASK SUCCESSFULLY COMPLETED!!

THANK YOU FOR READING!!

--

--