Content Delivery Network using AWS CLI
Amazon web service is a platform that offers flexible, reliable, scalable, easy-to-use and cost-effective cloud computing solutions. AWS is a comprehensive, easy to use computing platform offered Amazon. With multiple availability zones spread across the globe , it is necessary to provide the applications to the customers with least latency. The CDN ensures that the clients receive the data with least latency by having multiple copies of the fixed data in the nearest edge location to the customer. Amazon renamed this service as Amazon CloudFront.
What is a CDN ???
A content delivery network (CDN) refers to a geographically distributed group of servers that work together to provide fast delivery of Internet content.
Amazon is successful in providing this Content Delivery Network by creating multiple edge locations in demanded areas which is like a derivative to the availability zone of AWS that stores permanent data of the client. The client requests are handled by these nearest edge locations to reply the clients with least latency.
What’s the architecture to build this CDN ???
To build a CDN , we firstly require a web-application. We then deploy this web application with some permanent content like images and then provide the CloudFront domain to the web application code so that the when a client calls this web application , the content in cloudfront gets delivered with least latency.
For this , I deployed a web-application using Apache webserver (HTTPD).
The content , here an image is uploaded to the S3 bucket services of the Amazon that ensures the high redundancy to object storage.
Creation of S3 bucket ;
The objects inside the bucket are made public by default and can be read.
Uploading content to S3 Bucket ;
The image is made public , else an ACL can be set so that only Cloud Front services of the amazon can access the content.
CloudFront Creation ;
The domain name is set to the domain of the S3 bucket so that the contents inside the bucket can be delivered to all the edge locations across the globe.
Instance Creation ;
An instance to host the web server is created so that the web application can be hosted. Install the HTTPD web server inside the instance to host a basic HTML code.
EBS Creation ;
Create a volume in AWS called as EBS to store data persistent. Amazon ensures the availability of this EBS storage. Remember that this volume is per-region , that is this volume can only be attached to the instances within that region. So launch both EBS volume and EC2 instance in the same region.
Attaching and Formatting the volume ;
Attach the instance with the EBS volume created so that the storage can be made persistent
Make sure to format the volume before using it. Finally mount the volume on to a directory.
Mount it to the /var/www/html/ directory so that the web-application code remains persistent and multiple snapshots can be made in the future of the code if required. This helps in rolling back to the previous versions of the code.
HTML Code ;
The code inputs the image from the nearest edge location to the client as the domain is a cloufront URL.
Final Output ………
Access the web-application code via public IP of the instance to view the content of the HTML code. The image is from the cloudfront domain. Hence the integration was successful.
Thanks for going through the article. :) :) :) :)