High Availability Architecture with AWS CLI

High Availability Architecture with AWS CLI

Launching EC2 Instance and Attaching EBS Volume

Command for launching an ec2 instance : <aws ec2 run-instances --image-id ami-081bb417559035fe8 --subnet-id subnet-db1019b3 --instance-type t2.micro --key-name task_3 --security-group-ids sg-0bdcc0bd24bf50707 --count 1>

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

Command to attach an existing volume : <aws ec2 attach-volume  --volume-id vol-0f86e13bdceda5bb7  --instance-id i-03447a5502789ab48 --device   /dev/sdf>

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

Configuring the Webserver on EC2 instance

Command to install httpd webserver : <yum install httpd> Command for partition, format & mounting the partition on the default directory of httpd <fdisk /dev/xvdf> <mkfs.ext4 /dev/xvdf1> <mount /dev/xvdf1 /var/www/html> we can check above processes using <df -h> command or <lsblk> command

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

Creating S3 Bucket and Storing Image in it

Create a S3 bucket to store static data using command <aws s3api create-bucket --bucket tsk6 --region ap-south-1 --acl public-read --create-bucket-configuration LocationConstraint =ap-south-1>

Store the image in the created bucket using command <aws s3 cp C:\Users\91738\Desktop\aashish.png s3://tsk6/ --acl public-read>

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

Setting-up Content Delivery Network using CloudFront with S3 bucket as Domain origin

Create a cloudfront distribution using command <aws cloudfront create-distribution --origin-domain-name tsk6.s3.amazonaws.com>

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

Starting HTTPD service and creating a webpage in /var/www/html directory

Command to start the httpd services : <systemctl start httpd> Command to check the status of the httpd : <systemctl status httpd>

No alt text provided for this image

Add the image url as the cloud front url providing the image anme at last <img src = "http://d2gc1ajv95i0ol.cloudfront.net/aashish.png" width="100" height="140"/>

No alt text provided for this image

Add an inbound rule for accessing the webpage which is Tcp protocol of HTTP type

No alt text provided for this image

Now type the url of the created webpage on browser as <http://public_instance_ip/webpage_name> like <http://65.0.100.235/webpg.html>

No alt text provided for this image



To view or add a comment, sign in

Others also viewed

Explore content categories