Create High Availability Architecture 
 With AWS CLI
CloudFront and S3

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 Web App code for security and low latency.


What is the AWS Command Line Interface?

The AWS Command Line Interface (AWS CLI) is an open source tool that enables us to interact with AWS services using commands in our command-line shell. With minimal configuration, the AWS CLI enables us to start running commands that implement functionality equivalent to that provided by the browser-based AWS Management Console from the command prompt in our terminal program:

  • Windows command line â€“ On Windows, run commands at the Windows command prompt or in PowerShell.

WHAT IS IAM?

AWS Identity and Access Management (IAM) enables us to manage access to AWS services and resources securely. Using IAM, we can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources.

WHAT IS KEY-PAIR?

Key Pair consisting of a private key and a public key, is a set of security credentials that we use to prove our identity when connecting to an instance. We can use the private key, instead of a password, to securely access our instances.

WHAT IS SECURITY GROUP?

Security Group acts as a virtual firewall for our EC2 instances to control incoming and outgoing traffic. Inbound rules control the incoming traffic to our instance, and outbound rules control the outgoing traffic from our instance. If we don't specify a security group, Amazon EC2 uses the default security group.

WHAT IS EC2 INSTANCE?

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 us to obtain and configure capacity with minimal friction. It provides us with complete control of our computing resources and lets us run on Amazon’s proven computing environment.

WHAT IS EBS VOLUME?

An Amazon EBS (Elastic Block Storage) Volume is a durable, block-level storage device that we can attach to our instances. EBS volumes persist independently from the running life of an EC2 instance.We can attach multiple EBS volumes to a single instance. The volume and instance must be in the same Availability Zone.

WHAT IS S3?

Object storage built to store and retrieve any amount of data from anywhere. Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.

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.


PRACTICAL PART:-

Step1- First of all, we have to create a IAM User whose credentials (Access Key and Secret Key) are used to communicate with the AWS via Windows CLI. Follow the steps given below for creating an IAM User.

  • Click on Add User.
No alt text provided for this image
  • Set Username and then select Programmatic Access that provides us an access key and secret key.
No alt text provided for this image
  • Click on Attach existing policies directly and provide the AdministratorAccess to the user.
No alt text provided for this image
  • Give the tag to the IAM User and then click on Review.
No alt text provided for this image
  • Here, click on Download.csv.
No alt text provided for this image
  • Now, we can see that the IAM user is created successfully.
No alt text provided for this image

Step2- Now, we have to install AWS CLI for the Windows. Then we have to use aws configure command. If this command is run with no arguments, then we will be prompted for configuration values such as our AWS Access Key Id and our AWS Secret Access Key and Default Region. This command helps us in login to the AWS via CLI after providing our access and secret key.

No alt text provided for this image

Step3- Create a Key-Pair using CLI.

No alt text provided for this image

Output:-

No alt text provided for this image

Step4- Create a Security Group for our instance and then add the specified ingress rules to the security group  using CLI.

No alt text provided for this image
No alt text provided for this image

Output:-

No alt text provided for this image
No alt text provided for this image

Step5- Launch an EC2 Instance using the Key-Pair and the Security Group created by us in the previous steps.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Output:-

No alt text provided for this image

Step6- Create an EBS Volume using CLI.

No alt text provided for this image

Output:-

No alt text provided for this image

Step7- Attach the EBS Volume to the EC2 Instance created by us in the previous steps.

No alt text provided for this image

Output:-

No alt text provided for this image

Step8- Create a S3 bucket using CLI.

No alt text provided for this image

Output:-

No alt text provided for this image

Step9- Upload the Content to the S3 bucket using CLI and use the command to make the bucket and the content publicly accessible.

No alt text provided for this image

Output:-

No alt text provided for this image

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

ssh -i "AWS_KeyPair.pem" ec2-user@ec2-13-235-8-22.ap-south-1.compute.amazonaws.com
  • First of all, install httpd software for configuring webserver inside the EC2 Instance. Then start the services.
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
  • Use fdisk -l command to know how many Hard Disks are connected to the EC2 Instance.
No alt text provided for this image
  • Use the steps given below to create the Partition inside the EBS Volume. Now, we can use that partition to store our data permanently.
  1. Create a partition using fdisk.
No alt text provided for this image
No alt text provided for this image

2. Format the Partition using mkfs.ext4 command.

No alt text provided for this image

3. Then, mount the partition to the /var/www/html/ folder using mount command.

No alt text provided for this image

Step11- Go inside the /var/www/html/ folder and then create a file.

No alt text provided for this image
No alt text provided for this image

Step12- Type Public_IP/File_Name on the Browser.

No alt text provided for this image

Step13- Create a CloudFront Distribution on the top of AWS using CLI.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Output:-

No alt text provided for this image
  • Use CloudFront URL on the Browser:-
No alt text provided for this image

Step14- Now, give the CloudFront URL in place of S3 URL inside the file.html.

No alt text provided for this image

Step15- Again type Public_IP/File_Name on the Browser.

No alt text provided for this image


THANKS FOR READING!!!!

要查看或添加评论,请登录

Megha Varshney的更多文章

  • Multi Node Kubernetes Cluster Using Ansible..

    Multi Node Kubernetes Cluster Using Ansible..

    What is a Kubernetes Cluster? A Kubernetes Cluster is a set of nodes that run containerized applications. Kubernetes…

    4 条评论
  • How to Configure Web Server Inside the Docker Container by Retrieving Container's IP Dynamically Using Ansible Playbook?

    How to Configure Web Server Inside the Docker Container by Retrieving Container's IP Dynamically Using Ansible Playbook?

    Task Description ??:- ??Create an Ansible playbook that will retrieve new Container IP and update the inventory. So…

  • GUI Applications On The Top Of DOCKER

    GUI Applications On The Top Of DOCKER

    What is Docker? Docker is an open source project that makes it easy to create containers and container-based apps. With…

  • Integration of WordPress with Amazon RDS:-

    Integration of WordPress with Amazon RDS:-

    What is AWS ? Amazon Web Services (AWS) is a secure cloud services platform, offering compute power, database storage…

  • What is Jenkins and How Netflix uses it?

    What is Jenkins and How Netflix uses it?

    Hello guys, In this blog I’m going to explain the automation using Jenkins and a case study on Netflix. But before…

  • OpenShift and It's UseCases

    OpenShift and It's UseCases

    What is OpenShift ? OpenShift is a cloud development Platform as a Service (PaaS) developed by Red Hat. It’s an open…

  • Simple Queue Service by AWS

    Simple Queue Service by AWS

    What is SQS? SQS stands for Simple Queue Service. SQS is a managed message queue service offered by Amazon Web Services…

  • Neural Networks

    Neural Networks

    Neural Networks A Neural Network is a processing device, either an algorithm whose design is inspired by the design and…

  • Azure Kubernetes Service

    Azure Kubernetes Service

    What is Azure Kubernetes Service? AKS stands for Azure Kubernetes Service provided by Azure Cloud. It is an open-source…

  • KUBERNETES USE CASES - AIRBNB And PINTEREST

    KUBERNETES USE CASES - AIRBNB And PINTEREST

    What is Kubernetes? KUBERNETES is a container management system developed in the Google platform. Kubernetes is the…

    2 条评论

社区洞察

其他会员也浏览了