High-Availability Infrastructure setup on AWS using AWS CLI
Here we will be creating a High Availability Infrastructure setup using AWS Cloudfront, with origin from AWS S3 integrated on to a website hosted on AWS EC-2.
For this setup, we will be doing the complete setup using AWS CLI.
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
First we will create an EC-2 instance where the website will be hosted:
Now, we will be installing Apache httpd webserver on our instance which we created:
Creating EBS Volumes and attaching to EC2 Instance
Creating partitions, formatting and mounting the new drive to the required destination
Creating S3 bucket and uploading images to S3 bucket:
Now that we have created the bucket and uploaded a sample image to the bucket. It’s time we create a simple website using HTML5 and deploy it onto our webserver that we created.
Summary
So now that our website has been deployed, let’s take a brief look at what we have done.
We created an EC2 instance which we have used as a webserver and installed Apache httpd webserver onto it.
We created an external EBS volume and attached it to our EC2, we have done this because, when we delete an instance, the volume attached to it is also deleted. In order to make our code permanent, we attached another external volume and attached it to the required folder.
We created our S3 bucket and uploaded our image onto it.
We created a cloudfront distribution so that the data can be stored in multiple edge locations.
We created a simple website with the fqdn(fully qualified domain name) we got from the cloudfront distribution and used it in our website.