Create High Availability Architecture with AWS CLI

  1. launch ec2-instance
  2. with key pair and security group we can launch ec2-instance

configure webserver and enable httpd service

STEP-2 :- Document Root(/var/www/html) made persistent by mounting on EBS Block Device.

Below are the images in which we have created the EBS volume and then we attach this EBS volume to EC2 instance using AWS CLI commands and then we created filesystem and mount this EBS volume with document root

To create EBS volume :-

To attach ebs volume-:

o check EBS volume is successfully attached to EC2 instance or not and to create the filesystem for this new EBS volume :-

mount the ebs voloume

STEP-3 :- Static objects used in code such as pictures stored in S3

In this step we have created S3 bucket, uploaded the object in this bucket from local system and then we make this bucket and object public by applying/giving some permission :-

To create bucket :-

aws s3api create-bucket bucket_name region region_name create-bucket-configurationn LocationConstraint

To upload object from local system into the bucket :-

aws s3 cp file_to_copy s3://bucket_name — acl public-read

Now go to browser and search with Object URL, you will see your object because you make this object public :-

STEP-4 :- Setting up Content Delivery Network using CloudFront service and using the origin domain as S3 bucket.

In this step, we have created distribution using the domain name as S3 bucket :-

To create the cloudfront distribution using the domain name as S3 bucket :-

STEP-5 :- Finally place the Cloud Front URL on the webapp code for security and low latency.

In this step, we have created webpage and in this webpage we have provided the cloudfront distribution URL in the code for security and low latency.