🧱Setting Up High Availability Architecture using AWS CLI
To get started with AWS CLI and installation process refer docs
Lets see how we can create this High Availability Architecture :
✅Launch EC2 instance :
To configure AWS account :
Use : #aws configure
Here you need to specify the Access Key and ID along with Region Launching AMI Linux instance :
# aws ec2 run-instances --image-id ami-0e306788ff2473ccb --count 1 --instance-type t2.micro --key-name <key_name> --security-group-ids sg-09ac2ee9a41df7156 --subnet-id subnet-21212849
✅Configure Httpd Server in Instance :
Using Putty we have logged in into Instance
🎯To install Apache Webserver :
#yum install httpd -y
🎯Starting the Httpd Service:
#systemctl start httpd
#systemctl enable httpd
We have copied some web pages in document root (/var/www/html/)
Lets check if its working fine😎 or not ! :
Yes its working …………
👉Our requirement to make document root to be stored in persistent volume :
Thus , we can attach EBS volume to our instance lets see how :
✍To create Volume:#aws ec2 create-volume --volume-type gp2 --size 30 --availability-zone ap-south-1a✍To attach volume to instance :# aws ec2 attach-volume --volume-id vol-0174c90d2a3035f5e --instance-id i-0104eecbd16db9620 --device /dev/sdf
🧱Volume is created and attached to EC2 Instance :
To check if volume is attached or not :
Formatting the attach volume :
MOunting document root on EBS storage
#mount /dev/xvdb /var/www/html
Finally the Document Root(/var/www/html) made
persistent by mounting on EBS Block Device.
Now , we will create S3 bucket :
🖋Creating S3 bucket
#aws s3api create-bucket --bucket my-bucket --region us-east-1🖋Copying file from local system
#aws s3 cp C:\Users\USER\Desktop\test_ha.txt s3://testha1/test1.txt
Copying content into S3 bucket
Permitting access to bucket :
Providing read access of object to users :
Lets test the URL provided by S3
🔴Setting up CloudFront Setup :
#aws cloudfront create-distribution --origin-domain-name testha1.s3.amazonaws.com
Cloud Front provided high availability architecture . Content delivery networks provide a globally-distributed network of proxy servers which cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.
Put this URL into web-browser :
Thus , we have created High Availability Setup using CloudFront service of AWS.
CLOUD FRONT :
Amazon CloudFront is a content delivery network offered by Amazon Web Services. Content delivery networks provide a globally-distributed network of proxy servers which cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.
Amazon S3 :
Amazon S3 or Amazon Simple Storage Service is a service offered by Amazon Web Services that provides object storage through a web service interface. Amazon S3 uses the same scalable storage infrastructure that Amazon.com uses to run its global e-commerce network
AWS 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.
Amazon Elastic Compute Cloud is a part of Amazon.com’s cloud-computing platform, Amazon Web Services, that allows users to rent virtual computers on which to run their own computer applications.
Happy learning ….📚🤗