High availability aws cloud infrastructure using CloudFront
This 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.
Note:- all the steps discussed above should be done using the aws cli
- First we have to launch an instance :-
now here we can see the instance is launched.
- Now we have to create an EBS volume :-
here we can see the EBS volume of 1GB in size is created and we can also confirm this using the AWS GUI : the volume is created and it is available
- Attach this EBS volume to the instance launched:-
here we can see the volume is attached to the instance
- Now we have to create the partition in this EBS volume:-
- Formating the partition :-
- Mount the partition:- now we have to mount the partition to the /var/www/html to make the webserver root document persistent , for this we have to use this command
ssh -i hadoop_slave_key.pem [email protected] sudo mount /dev/xvdc /var/www/html
here we can also see with the help of instance terminal that the partition is mounted to the /var/www/html
- now we have to configure the webserver in the launched instance :- for launching the instance we have to follow these steps : -
- install the webserver :- here we are installing the apache webserver
2. start the services:- here we can see the services is running
- Now we have to create the S3 bucket for storing the object:-
we can also verify this using the AWS GUI that bucket deepak9031 is created :
- Making the bucket public:-
- Putting the object in this bucket :- for this we have to give the bucket name in which the object will be stored and we also have to give the location of that object
- Making the object public:- for this we have to give the permission and here i am giving the permission to public-read-write with the help of this command
aws s3api put-object-acl --acl public-read-write --bucket deepak9031 --key deepak1.jpeg
- Setting the cloudfront:- for this we have to give the origin domain name and the name of the object for which we are creating the distribution
here we can see distribution is created :
- Now the last step is we are creating a html page in this webserver in which we are using this distribution for low latency using cli :- file name is arth_task6.html
CONCLUSION = We can see the file is successfully created and for storing the code we used EBS volume and for storing the object we use S3 services of aws and for reduce the latency we set a distribution for providing the content delivery network using cloudfront , and this distrubution is used inside the page for object.
THANK YOU FOR READING THIS ARTICLE .........