Create High Availability Architecture with AWS CLI
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.
Step 1:
Create an IAM user to access AWS CLI. Then use the following command to access the AWS service through CLI,
Then create a key pair & security group to launch an instance
key pair is a set of security credentials that you use to prove your identity when connecting to an instance.
A security group acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic.
Launching an instance using above create key pair and security group
Step 2:
Create an EBS volume
It is an block-level storage device that you can attach to your instances. After you attach a volume to an instance, you can use it as you would use a physical hard drive. EBS volumes are flexible.
Attach an EBS volume to the launched instance,
Step 3:
Install Apache Server On The Instance
Step 4:
Create a Partition on the attached EBS volume:
Format & Mount the Partition:
Step 5:
Create a S3 Bucket,
S3 is the only object storage service that allows you to block public access to all of your objects at the bucket or the account level with S3 Block Public Access.
Upload your picture to the S3 Bucket
Step 6:
Create a Cloud Front Distribution:
CloudFront is a fast content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to customers globally with low latency, high transfer speeds, all within a developer-friendly environment
Step 7:
Go to the path /var/www/html in your instance and create an .html file and add the cloud front URL in your script
Now lets take a look at our Web page