CLOUD FRONT DISTRIBUTION

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.

Prerequisites for this task:

· You need a IAM user having Administration Power.

· AWS-CLI Installed in your local system.

· One ec2-instance.

In my case I already completed the prerequisites so if you don’t have then please go through with this blog : https://swarnim1345.medium.com/task-description-aws-2f80d71af795

:::::::::::::::::::::::::::Lets Get Started::::::::::::::::::::::::::::

STEP 1:

First of all login to your AWS Instance via cli by providing the Credential of IAM USER.

cmd “aws configure

Step2: Create a ec2-instance

aws ec2 run-instance –image-id ami-081bb417559035fe8 — instance-type t2.micro — subnet-id subnet-bd0c05d5 — count 1 -security-group-ids sg-e1f72586 — key-name mykey

Verify via WEBUI that instance is successfully created 👇

Step3:

· Login your instance with root power “sudo su -root”

· Install apache httpd package “yum install httpd”

Step4:

Create a EBS volume of 1GB.

Take confirmation via WebUI.👇

Step5:

Attach your EBS volume to your instance.

To check that volume is attached or not, goto your instance and type “fdisk -l” for confirmation

Step 6:

Create partition and mount the connected EBS disk to the folder in a instance.

·# command to start partition process
fdisk /dev/xvdh

·# write the following options
# select p to the the details of the partitions available

p

· # select n to create a new partition
n

· # select p for the primary or e for extended partition
p

· # Select the number of partitions 1–4
1

· # Starting of the first sector, starting from 2048 as a default.
Press Enter without any changes

· # Ending of the sector, ending at 2097151 as default(entire size)
Press Enter without any changes

· # Press p to see the details of the partition
p

To format the partition : “mkfs.ext4 /dev/xvdb”

· To mount : “mount /dev/xvdb /var/www/html”

Step7:

· Change directory to “cd /var/www/html/”

· Create a file “vim index.html” and write some content in the file.

Step8:

Start your httpd service.

Type your instance public IP along with file name on the web browser to configure the webserver “https://65.1.100.132/index.html”

Step 9: Create S3 Bucket:👇

“aws s3 mb s3://mybucketswarnim — region us-east-1”

Step 10: Copy your image/file into the bucket 👇

“aws s3 cp C:\Users\hp\Desktop\IMG-5517.jpg s3://mybucketswarnim”

· Verify via WebUI.

· Make your object/file public so that outside world can easily access your object/file.

……………………………..👇…………………………………………

Step 11: This is our final sped in this we create our Cloud Front Distribution.👇

“aws cloudfront create-distribution — origin-domain-name mybucketswarnim.s3.us-east-1.amazonaws.com — default-root-object index.html”

Verify it via WebUI 👇

Now the last thing we have to do here is provide the domain name of the Distribution in the “img src tag of intex.html” file 👇

Now access the website using the public domain or public ip of the EC2 instance.👇

YEAH! Finally i have completed the CLOUD FRONT DISTRIBUTION🙌

Thankyou

BY- SWARNIM KASHYAP

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Swarnim Kashyap

Swarnim Kashyap

7 Followers

RedHat Certified Engineer| DevOps Enthusiast | Big Data Hadoop | RedHat Linux 8| AWS Cloud | GCP | Azure Cloud |GIT & GitHub |Python