Creating High Availability Architecture with AWS CLI
→ AWS EC2 INSTANCE|WEBSERVER|EBS|S3|CLOUDFRONT ←
Let’s learn some basics about the AWS High Availability architecture:-
What is AWS?
Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully featured services from data centers globally. Millions of customers — including the fastest-growing startups, largest enterprises, and leading government agencies — are using AWS to lower costs, become more agile, and innovate faster.
What is AWS-CLI?
AWS-CLI(Amazon web services-Command line interface) is an open-source tool that enables you to interact with AWS services using commands through our command prompt in command line. This AWS-CLI provides the same functionality as WEB-UI based on AWS management console.
What is WEBSERVER?
A Web-Server delivers content for a website to a client that requests it, like a web browser. A web server communicates with a web browser using HTTP. The main job of a web server is to display website content through storing, processing and delivering webpages to users.
What is EBS?
Amazon Elastic Block Store (EBS) is an easy to use, high performance block storage service designed for use with Amazon Elastic Compute Cloud (EC2) for both throughput and transaction intensive workloads at any scale. A broad range of workloads, such as relational and non-relational databases, enterprise applications, containerized applications, big data analytics engines, file systems, and media workflows are widely deployed on Amazon EBS.
What is S3?
Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as data lakes, websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.
What is 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. CloudFront is integrated with AWS — both physical locations that are directly connected to the AWS global infrastructure, as well as other AWS services. If you use AWS origins such as Amazon S3, Amazon EC2 or Elastic Load Balancing, you don’t pay for any data transferred between these services and CloudFront. Amazon’s CDN offers a simple, pay-as-you-go pricing model with no upfront fees.
****************************************************************
Task Description📄
🔰 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 a key-pair
Step-2: Create a security group
Step-3: Create an INBOUND rule
REMEMBER: Create a VPC security group for a public web server. Make sure that the security group that you choose includes inbound rules for Secure Shell (SSH) and HTTP access.
Step-4: Create an EC2 instance
Step-5: Create an EBS volume of size 1GiB
Step-6: Attach EBS volume created above to the previous launched instance
Step-7: Check Volume attached to the EC2 instance
Using command:- # fdisk -l
Step-8: Create the partition of size 1023 MB of volume attached
Using command:- # fdisk /dev/xvdf
Step-9: Format the partition
Using command:- # mkfs.ext4 /dev/xvdf
Step-9: Mount the partition to the Document root(/var/www/html)
Using command:- #mount /dev/xvdf /var/www/html/
Step-10: Check the mount partition
Using command:- # df -h
Step-11: Install ‘httpd’ package to set-up WebServer
Install software using command:- # yum install httpd
After installing ‘httpd’ software, start the service ,using command:-
# systemctl start httpd
# systemctl status httpd
Step-12: Create a html file to the /var/www/html folder
Html file created using command:- # vi <file-name>.html
Step-13: Create a S3 Bucket
Step-14: Upload the local file(or image) to the S3 bucket
Step-15: Change object permission to public read in S3
Step-16: S3 object URL
Step-17: Open this object URL to the browser
Step-18: Write some html code and put this S3 Object url in ‘webscli.html’ file
Step-19: Open the html file — ‘webscli.html’ to the Browser
Step-20: Create CloudFront distribution using Origin as S3 object URL
Step-21: Open the CloudFront URL to the Browser
Step-22: Place the CloudFront URL into the webserver
Here, Mention this CF Url in the html code in ‘webscli.html’ file into our webserver for low latency and making cache at near-by edge location.
Step-23: Run the html file in the Browser
Thus, In the WebApp, the static file(or image) comes from CloudFront Service origin as S3 object url and storage(or html code) is of EBS Volume (persistent) and the WebServer is running on EC2 instance.
Hence, TASK-COMPLETED successfully!
THANK YOU(*-*)✨