🔰 Create High Availability Architecture with AWS CLI Using CloudFront , S3 and EBS 🔰

🔰 Create High Availability Architecture with AWS CLI Using CloudFront , S3 and EBS 🔰

💥 EBS:-

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. 

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

💥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. CloudFront delivers your content through a worldwide network of data centers called edge locations.


💥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 webapp code for security and low latency.

🖥️Create a key

aws ec2 create-key-pair --key-name "key_name"

No alt text provided for this image

✍️Step 1 : Launch an EC2 Instance from CLI

aws ec2 run-instances --image-id    "image_id" --instance-type    t2.micro --count 1 --subnet-id subnet-94565ffc --security-group-ids "Security_group_id" --key-name "key_name"

No alt text provided for this image
No alt text provided for this image

✍️Step 2 : Now we have to create EBS volume

aws ec2 create-volume --volume-type gp2 --size 4 --availability-zone ap-south-1a

No alt text provided for this image
No alt text provided for this image

 ✍️Step 3 : Attach EBS Volume to EC2 Instance

aws ec2 attach-volume  --instance-id  "instance-id" --volume-id "volume-id"  --device /dev/xvdf
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

✍️Step 4 : Now we have to configure webserver for this we have to install httpd

ssh "instance_ip -i "key_name" -l ec2-user sudo yum install httpd -y
No alt text provided for this image
No alt text provided for this image

🖥️Creating partition :

ssh "instance_ip" -i "key_name" -l ec2-user sudo fdisk /dev/xvdf
No alt text provided for this image

🖥️Formatting partition :

ssh "instance_ip" -i "key_name" -l ec2-user sudo mkfs.ext4 /dev/xvdf1

No alt text provided for this image

🖥️mounting to /var/www/html

ssh "instance_ip" -i "key_name" -l ec2-user sudo mount  /dev/xvdf1  /var/www/html

No alt text provided for this image

🖥️Check partition :

No alt text provided for this image

✍️Step 5 : Now we have to create S3 Bucket from CLI

aws s3api create-bucket --bucket "bucket_name" --region "region_name --create-bucket-configuration LocationConstraint=ap-south-1
No alt text provided for this image
No alt text provided for this image

🖥️upload the image in S3 Bucket

aws s3 cp "file name" s3://"bucket_name"/ --acl public-read-write
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

✍️Step 6 : Create CloudFront Distribution :

aws cloudfront create-distribution --origin-domain-name "origin_domain_name"
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

✍️Step 7 : Finally now we create html file in EC2 instance and give the image url of CloudFront

No alt text provided for this image
http://13.233.123.166/aro.html


No alt text provided for this image
No alt text provided for this image


To view or add a comment, sign in

More articles by Arpit Patel

Others also viewed

Explore content categories