Create High Availability Architecture with AWS CLI Using CloudFront , S3 and EBS !!
‼️ Hello Connection ‼️
What is 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.
What is S3 ?
Object storage built to store and retrieve any amount of data from anywhere. Get started with Amazon S3. Request more information. Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.
What is 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.
➡ NOW KNOWING THESE VOCABULARY WE ARE GOOD TO GO FOR A COMPLETING FOLLOWING TASK❕❕
💢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.
🎯 Step 1 : Create Key pair
aws ec2 create-key-pair --key-name key_name--query KeyMaterial --output text > key_name.pem
🎯 Step 2: Launch Ec2 Instance From CLI
aws ec2 run-instances --image-id image_id--instance-type t2.micro --count 1 --subnet-id subnet_id --security-group-ids sg_id--key-name key_name
🎯 Step 3: Now we have to create EBS volume
aws ec2 create-volume --volume-type gp2 --size 5 --availability-zone ap-south-1a
🎯 Step 4: Attach EBS Volume to EC2 Instance
aws ec2 attach-volume --instance-id i-0c97e97b0577a6a8a --volume-id vol-05e764c43bbd1dbec --device /dev/xvdf
🎯 Step 5: Now we have to configure webserver for this we have to install httpd
Using ssh command we can do it by our terminal
ssh IP -i <key> -l ec2-user sudo install httpd -y
➡️ Creating partition :
fdisk device_name
➡️ Formatting partition :
mkfs.ext4 partition_specified
➡️ Mounting:
mount partition_name folder_name
Step 6: 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
Step 7: Upload Image in S3 Bucket
aws s3 cp image_path bucket_url
🎯 Step 8: Create CloudFront Distribution :
aws cloudfront create-distribution --origin-domain-name <domain_name>
🎯 Step 9: Finally now we create html file in EC2 instance and give the image url of CloudFront
http://13.233.166.76/sample.html
🌌This Task is Also Completed By Using Scripting …
➡ Link To Refer Script File:
Thanks For Reading The Article…!!