High Availability Web Server Architecture using AWS CLI
- Task Description:
- webserver configured on ec2 instance.
- Document root(/var/www/html)made persistent by mountingon EBS block device.
- Static objects are 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 web app code for security and low latency.
Now let's get to the task:
Here we will discuss about some basic definations:
- EC2: Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment.
- 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.
S3: Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.
- Amazon S3 is designed for 99.999999999% (11 9’s) of data durability because it automatically creates and stores copies of all S3 objects across multiple systems. This means your data is available when needed and protected against failures, errors, and threats.
- WebServer:A web server is server software,that can satisfy client requests on the World Wide Web.
- A web server processes incoming network requests over HTTP and several other related protocols.
Implementation:
Step 1:configure aws.
Step 2:create an EC2 instance to configure the webserver on it.
- We can see my EC2 instance is configured and now running.
Step 3:Now Creating an EBS volume and attaching the volume to the above instance.
Step 4:Installing httpd server.
- Commands: yum install httpd
- systemctl start httpd:This will help us to start the services.
- systemctl status httpd:This will help us to check wheather my web server is active or in-active.
- systemctl enable httpd:To enable permanently the services.
For configuring HTTPD server we have to login with the instance on top of which the server is to be configured.
Therefore, httpd server is configured and is running.
Step 5:Now partition,format and mount the EBS volume.
- fdisk -l:To check wheather my volume is attached or not.
- lsblk:To see how many partitions and harddisks are available.
- n:To create new partitions
partition type-p:primary partition (In one harddisk we can create only max 4 partitions).
e-extended(like a hardisk where we create logical partitions).
format:mkfs.ext4 /dev/xvdb1 mount:mount /dev/xvdb1 /var/www/html
Webpage is created in the folder /var/www/html.
Step 6:Creating s3 bucket
Uploading image into newly created S3 bucket:
Step 7:Creating a cloudFront distribution:
In the above image we can see Origin Domain:URL of the S3 bucket containing our data.
Step 8:Finally,Lets run our webpage with high availability architecture.
Thankyou for reading my article...