🎗️High Availability Architecture with AWS cli🎗️

Anuja Kumari
4 min readOct 30, 2020

Hello guys!!😄

Today’s my Article on Cloudfront practical using AWS CLI.

🔆 Let’s begin by understanding Cloudfront 🤩🤩

◾Amazon CloudFront is a fast content delivery network (CDN) service that delivers data, videos,applcation, and APIs to customers globally with low latency, high transfer speeds.

◾By using Amazon CloudFront, we can cache our content in CloudFront’s edge locations worldwide and reduce the workload on our origin by only fetching content from our origin when needed.

🎗️TASK DESCRIPTION 🎗️

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 web app code for security and low latency.

•Follow my article for previous steps..

https://medium.com/@anujapathak998/aws-command-line-interface-378ad28a1a8b

👉 Webserver configured on EC2 instance

➡️ First install httpd

➡️ To start httpd service

So, we have configured webserver.

👉Now, the volume that we attached in previous article we have to mount that volume to the document root (/var/www/html) to make it permanent.

•For this

➡️First Create partition.

➡️ Formate the Partition

You can see formatting the partition

➡️ Now, Mount this partition to root document

👉 Static objects used in code such as pictures stored in S3

➡️ First Create a s3 bucket.

By using Command….

aws s3api create-bucket --bucket aws-2-task --region ap-south-1 --create-bucket-configuration LocationConstraint=ap-south-1

Let’s cross-check it on GUI..

➡️ Then, Insert a image in the bucket.

You can see status of image in Web GUI..

➡️ Now make the bucket and image Public

for bucket

aws s3api put- bucket -ac1 --ac1- public read --bucket aws-2-task

for object

aws s3api put-object-acl --bucket aws-2-task --key download.jpg --grant-read url=http://acs.amazonaws.com/groups/global/AllUsers

Let’s check this on GUI

➡️ Now, we can see the object from Browser…

Image displayed with low speed and high latency.

So, for high speed and low latency, use the concept of Cloudfront.

👉 Setting up Content Delivery Network using CloudFront and using the origin domain as S3 bucket.

➡️ Now, Create Cloud front distribution

By using Command..

aws cloudfront create-distribution --origin-domain-name aws-2-task.s3.amazonaws.com --default-root-object download.jpg

Let cross- check it on GUI..

👉 Finally, place the Cloud Front URL on the web app code for security and low latency.

➡️ For this, create a small HTML code

➡️ Now, Let’s See the webserver

Image displayed with high speed and low latency.

Thanks for reading !!😄✌🏻

📖Keep Learning !! Keep Sharing !!📝

--

--

Anuja Kumari

Learner @ Linuxworld Informative Pvt Ltd || DevOps(Docker,K8S, Jenkins, Terraform, Git and GitHub) || AWS || ( Python | Java )