Deployment of High Availability Architecture with AWS CLI

 Hello Connections !!!

Hope you all are safe and doing well ... In my previous article of AWS CLI , I had demonstrated as to how we can use high level aws commands from our terminal and use various AWS services .... ( like launching EC2 instances and creating and attaching EBS volumes, attaching it,  )

In this article ... We will continue our journey as to how we can create a high availability architecture using the concept of Content Delivery Network ( CDN ) via a service of AWS known as CloudFront using AWS CLI .



Here is the list of things to be configured and deployed :

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.

!!! Let's jump on directly !!!!

--> First Starting an EC2 instance that we last created with CLI( Use the below command )


--> Verification from WebUI whether instance is launched and running or not :

--> Creating an EBS volume ( Use the below command )

--> Attaching the above created volume to our launched instance (Use the below command)


-->Log into the instance using your key with ssh command, install httpd server and start their services and create a html file in /var/www/html folder

🔷yum install httpd
🔷Systemctl start httpd


--> Running the fdisk -l command on the terminal to list the disks and devices on our system, Create partition, format it, mount it to /var/www/html directory

Commands for these :

🔷fdisk <device name>

🔷 mkfs.ext4 <device name>

🔷 mount <device name> <folder name>


--> if you cannot see your webpage make sure you allowed port no.80 in security groups, still webpage not visible then set SELinux to permissive mode (setenforce 0)

--> Next , let's create an S3 bucket and also set its permission using AWS CLI . ( Use the below commands )

--> Next , let's check the permission on S3 bucket using AWS CLI . ( Use the below commands )

--> Put an object ( in this case an image file ) inside the above created bucket and also set its access details [ Use the below commands ]

--> Now put the object URL inside web browser to verify it is public or not

--> Here when anyone request for the webpage the image is retrieved from the Mumbai S3 region , hence if anyone is requesting it from far distances from this region , some delay may happen for it to open . To overcome this , we can use CloudFront as a service .

--> Create a CloudFront distribution using AWS CLI (m Use the below command )




--> When we created cloudfront it provided us with our domain name which we can enter in our browser and can see whether our cloudfront domain is working fine or not

--> Now update our html code and place cloudfront URL in img tag

--> We can verify now that our website is using cloudfront cached image data and showing it to us through one of our nearest edge location


--> We can check our CloudFront reports in our Cache Statistics


This is how we can step by step deploy high availability architecture using the concept of CDN via CloudFront service of AWS ....

Hope you all found this article interesting

Thank You 



Comments

Popular posts from this blog

Supercharge your Business with Amazon Web Services

AWS using CLI Mode