
Designing High Availability Architecture with AWS S3 & CloudFront Using AWS CLI
!! 𝗛𝗲𝗹𝗹𝗼 𝗖𝗼𝗻𝗻𝗲𝗰𝘁𝗶𝗼𝗻𝘀 !!
✨ Welcome you all to my article based on TASK-6 of ARTH — The School Of Technologies ✨
Task 6 Description — ARTH 👨🏻💻
✳️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.
All the above steps must be performed using AWS CLI
To accomplish this we will have to integrate AWS S3 with AWS CloudFront Service .
What is 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.
What is AWS S3?

Amazon S3 or Amazon Simple Storage Service is a service offered by Amazon Web Services that provides object storage through a web service interface. Amazon S3 uses the same scalable storage infrastructure that Amazon.com uses to run its global e-commerce network.
Lets start with the task.
STEP 1
First we have to launch one EC2 Instance from CLI in which we configure the Apache Webserver .
We have to install AWS CLI on Windows and then configure it with access key ID , Secret Access Key


Checking in AWS site to confirm if our instance is created or not

Instance Created Successfully
STEP 2
Now we have to create one EBS Volume which serves as Document Root Device .After creating EBS Volume let’s attach it to the EC2 Instance .

Confirming through Web UI if our volume is created or not

Volume Successfully Created
Now Attaching Volume to our Instance.


STEP 3
3) To configure webserver we have to first Install httpd service package and start their services. Now , To connect to EC2 Instance we have to use PUTTY Program
⏩ Installing httpd package :


STEP 4
4) To make document root /var/www/html of apache web server we have to mount it on EBS Volume . For these first we have to create Partition then format it .
⏩ Creating the partition :

⏩ Formatting the partition :

⏩ Mounting the Document root /var/www/html on EBS Volume partition :

⏩ Checking the partition :

STEP 5
After making the code inside document root permanent , now we have to put the static content like images used in web code into the S3 Bucket for better availability . For these we have to create one S3 Bucket .

Confirming through WebUI if S3 bucket is successfully created or not.

Now we have to upload our file/objects inside S3 Bucket

Here the attribute called acl stands for Access Control List . Now we have to decide the value of acl whether the S3 Bucket made public or private .
Confirming through WebUI

Using the URL provided to the object by S3 we can now access the Image .

STEP 6
To access these Image We are now using S3 URL due to these we have to go travel through public Internet Network which may cause some kind of Delay or Latency or may be disconnection . Since Rather than Giving these Image URL we prefer AWS Cloud Front which is one kind of Content Delivery Network which provide one unique URL to S3 Object by which users from anywhere can access or see these content with less latency and fast connectivity via AWS Private CDN and Edge Locations .
To setup Content Delivery Network of AWS we have to create CloudFront Distribution for S3 bucket objects


Confirming the same through WebUI

STEP 7
We can see that CloudFront provides one Domain Name or unique URL to access the content with fast speed and low latency . Now we have to give these Cloud Front URL in our Code for the Image instead of S3 URL .

STEP 8
Finally we can see our web page hasnow become more faster in terms of speed as one of the part of web page that is image is coming from AWS Cloud Front CDN .
