?? 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.
?? We have to launch EC2 Instance for configure the Apache Webserver using AWS CLI.
aws ec2 run-instances --image-id <img_id> --instance-type <type> --count 1 --subnet-id <subnet_id> --security-group-ids <Sgroup_id> --key-name <key_id>
?? Command for create EBS volume :-
aws ec2 create-volume --volume-type <volume_type> --size <volume_size> --availability-zone <zone_type>
?? Command to Attach EBS Volume to EC2 Instance :-
aws ec2 attach-volume --volume-id <volume_id> --instance-id <instance-id> --device /dev/sdf
?? We have to install and start httpd service to configure webserver :-
?? Create Partition :-
Command to create partition :-
fdisk /dev/xvdf
?? Command to format partition :-
Command to formatting the partition :-
mkfs.ext4 /dev/xvdf1
?? Document Root(/var/www/html) made persistent by mounting on EBS Block Device :-
mount /dev/xvdf1 /var/www/html
?? Static objects used in code such as pictures stored in S3.
?? Create S3 bucket :-
aws s3api create-bucket --bucket <bucket_name> --region <select_region> --create-bucket-configuration LocationConstraint=ap-south-1 --acl public-read
?? Uploading image to S3 bucket :-
aws s3 cp <local_directory_file_path> s3://<bucket_name> --acl public-read
Write HTML code for Displaying image :-
File Name - lw.html
Folder Name - /var/www/html
Now we can see on browser using URL : <public_IP of instance>/<file_name>.html
? Here we are using S3 URL. We see that => Image displayed with low speed and high latency. To avoid this problem we have to use the concept of Cloud Front.
?? Setting up Content Delivery Network using Cloud Front and using the origin domain as S3 bucket.
?? Create Cloud Front :-
aws cloudfront create-distribution --origin-domain-name <domain_name>
?? Finally place the Cloud Front URL on the webapp code for security and low latency.
Now we can see on browser using URL : https://domain_name/<image_name>
? Here we can see that => Image displayed with High speed and Low latency.
??????So We have we have successfully performed the task??????
Thanks Mr.Vimal Daga (Mentor) for giving such a challenging task which helps to me to explore my core concepts of Cloud Computing .