High Availability Architecture With AWS CLI
Task Description:
- 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.
- Then Finally place the Cloud Front URL on the webapp code for security and low latency.
What is S3?
Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites.
What is CloudFront?
CloudFront is a CDN (Content Delivery Network). It retrieves data from Amazon S3 bucket and distributes it to multiple datacenter locations. It delivers the data through a network of data centers called edge locations. The nearest edge location is routed when the user requests for data, resulting in lowest latency, low network traffic, fast access to data, etc.
Let’s get started with the task.
Firstly , we have to login to aws cli . we can do so by using cmd
aws configure
For login we will require access key and secret key.
Step1: Creating an ec2 instance
Let’s check if instance is created or not.
Step2: Creating EBS volume
Step3: Attaching EBS volume to Instance
Step4: Now we will create partitions and mount
We have created a partition and even formatted it. But we want to mount /var/www/html folder . so, we will download httpd.
Now we will mount.
Step:5 Creating s3 bucket
Now we will upload an image to s3 bucket.
Image has been uploaded. Now we will make it public ,so that it is accessible.
Then , we will create a file inside /var/www/html folder.
Step:6 Creating CloudFront Distribution
Now , we can even access the site using cloudfront url.
Thank You!!