Create High Availability Architecture with AWS CLI

Abhijeet Bakale
4 min readApr 1, 2021

--

In this post, we will see how we can create a high availability architecture through AWS content delivery network“cloud front”and domain as S3 bucket.We are also making the configuration file of apache web server persistent by mounting the ebs volume there.

About cloudfront

Amazon CloudFront 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. CloudFrontdelivers your content through a worldwide network of datacenters called edge locations. When a user requests contentthat you’re serving with CloudFront, the request is routed tothe edge location that provides the lowest latency (time delay),so that content is delivered with the best possible performance.

Use cases:

  • If the content is already in the edge location with the lowest latency, CloudFront delivers it immediately.
  • If the content is not in that edge location, CloudFront retrieves it from an origin that you’ve defined — such as an Amazon S3 bucket, a MediaPackage channel, or an HTTP server (for example, a web server) that you have identified as the source for the definitive version of your content.

About S3:

Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as data lakes, websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.

Use-case:

Amazon S3 Standard

It is perfect for a wide variety of use cases including cloud applications, dynamic websites, content distribution, mobile and gaming applications, and Big Data analytics. For example, a mobile application collecting user photo uploads. With unlimited storage, there will never be a disk size issue.

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 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.

Getting started

Logging in to our aws using our command line interface.

Launching our instance using our created key-pair and Security group through aws cli.

Installing our HTTPD server through yum install httpd command.

Creating and Connected EBS volume to our EC-2 instance

We can see a new volume connected.

Formatting our EBS volume so that we can mount.

Mounting our formatted drive to the /var/www/html storage and making it persistent.

Creating our S3 bucket through cli.

Adding image to our S3 storage.

Checking the S3 bucket through amazons graphical interface.

Creating CloudFront distribution.

Enabling our HTTPD server.

Now the EBS is mounted to /var/www/html folder.

Finally added a very basic html code to our webpage folder so that when client opens the webpage it will display image through our object storage(S3).

conclusion: Hence we have learnt to how we can create a high availability architecture through AWS content delivery network“cloud front”and domain as S3 bucket

--

--