Deploying High Availability Architecture with AWS CLI

Riyazuddin
6 min readNov 7, 2020

--

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.

What is AWS Cloud

AWS (Amazon Web Services) is a comprehensive, evolving cloud computing platform provided by Amazon , providing services for compute, databases, infrastructure management, application development , security and many more services.

Amazon Web Services provides services from dozens of data centers spread across availability zones (AZs) in 25 regions across the world.

AWS offers you a pay-as-you-go approach for pricing for over 160 cloud services. With AWS you pay only for the individual services you need, for as long as you use them, and without requiring long-term contracts or complex licensing.

1. EC2 Service

Amazon Elastic Compute Cloud is a service that provides virtual servers — called EC2 instances — for compute capacity like processor , RAM and Storage.

2. EBS volume (Block Storage)

Amazon Elastic Block Storage provides block-level storage volumes for persistent data storage when using EC2 instances.

3. S3 (Object Storage)

Amazon Simple Storage Service (S3) provides scalable object storage for data backup, collection and analytics.

4. CloudFront

Amazon 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

Here we start to deploy hold tightly —

1. AWS configure

To Configure AWS on Windows CLI we used IAM user (with power access permission) AWS access Key ID and AWS secret Access ID.

2. Creating key pair

A key pair is a set of security credentials that you use to prove your identity when connecting to an instance .

aws ec2 create-key-pair --key-name 'key name' --output text > filename.pem

3. Creating Security group and Allowing port

A security group acts as a virtual firewall for your instance to control inbound and outbound traffic so , we are going to allow port 22 for accessing SSH protocol to login remotely and port 88 to access Webserver. command is mentioned below -

4. Launching Instance

Now using Key pair and Security Group we are going to launch the EC2 instance and naming it using tags.

5. Creating Volume

We are going to create volume which will act like Pen drive which help to store data permanently even when our instance get crashed and then our data will be portable from one instance to other.

6. Attaching EBS Volume

To attach EBS volume which we have created to created instance we use below command.

7. Create S3 bucket

We are using S3 buckets to save all the static things like images which we are going to use in our webpages.

7. Uploading static data to S3

To upload the static data from our instance to S3 bucket publicly we used the below command.

8. Login through SSH

Now use a command given below for login to the EC2 Instance.

Access root to deploy server or we can use sudo.

9. Install Apache Webserver

After connecting to instance we switch to root user which have all the authority of the instance .

Then we install HTTPD which is Apache Webserver.

Format Volume which we have created earlier and make a partition.

Mount the partition to /Var/www/html/

Create a file inside /var/www/html with some html static code and image.

11. Cloud front Distribution

I am going to use the cloud front service so we can access the data from any where in the world with low latency and high efficiency. To distribute S3 data to all Edge Location of AWS , we use below command.

Check the cloud front url with same image which we uploaded earlier.

To access the Webpage from the web browser we create webpage at location /var/www/html

12. Add cloud-front domain name of distribution to webpage

To access the image of S3 which we are accessing through cloudfront, I used the cloudfront image URL in our webpage as mentioned below.

At the end final output with cloudfront data.

Thank you for showing your interest

--

--

Riyazuddin
Riyazuddin

Written by Riyazuddin

Versatile Solution Architect with 12+ years in web SaaS solutions based in a clouds, migration, monitoring and administration with DevOps Automation Tools.

No responses yet