Create High Availability Architecture with AWS CLI

Create High Availability Architecture with AWS CLI

The article 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.

To Perform This Task You should have an aws account and an IAM user .

STEP 1:Download aws CLI and configure it.

No alt text provided for this image

STEP 2: START AN INSTANCE

No alt text provided for this image
No alt text provided for this image
COMMAND : aws ec2 start-instances --instance-ids <ID_OF_YOUR_INSTANCE>
No alt text provided for this image


STEP 3: Create an EBS volume and then attach it to the instance.

No alt text provided for this image
COMMAND TO CREATE AN EBS :
 aws ec2 create volume --availability-zone <AZ_CODE> --size <SIZE> 
No alt text provided for this image

STEP 4 : Now attach the volume to the instance

No alt text provided for this image


COMMAND TO ATTACH AN EBS:
aws ec2 attach-volume --volume-id <VOLUME_ID> --instance-id <INSTANCE_ID> --device <STORAGE_NAME>

Before using this attached volume , it must be partitioned and formatted first.

( here ssh program is used to login and run the command )

No alt text provided for this image


STEP 5 : PARTITIONING :

COMMAND TO CREATE PARTITION:
ssh -i <KeyPair_Name> <USERNAME@IP> sudo fdisk <STORAGE_NAME>
No alt text provided for this image

n ( for new partition)

press enter (it will be first partition only)

press enter (it will be counting the space from initial sector)

w (save the partition and exit)

No alt text provided for this image

STEP 6 : FORMAT the partition with ext4 :

COMMAND : ssh -i <KEY_PAIR_NAME <USERNAME@IP> sudo mkfs.ext4 <PARTITION_NAME> 
No alt text provided for this image

STEP 7 : Now Install httpd server using yum command

COMMAND : ssh -i <KEYPAIRNAME> <USERNAME@IP> sudo yum install httpd -y
No alt text provided for this image

STEP 8 : Start the httpd service:

COMMAND : ssh -i <KEYPAIRNAME> <USERNAME@IP> sudo systemctl start httpd

Check the status of the service:

COMMAND : ssh -i <KEYPAIRNAME> <USERNAME@IP> sudo systemctl status httpd
No alt text provided for this image

STEP 9 : Now , Mount the /var/www/html folder to the created partition of the EBS volume

COMMAND : ssh -i <KEYPAIRNAME> <USERNAME@IP> sudo mount <Partition_name> /var/www/html
No alt text provided for this image


To check the web server configuration create a small code and access it through the webUI

NOTE : save the code in /var/www/html directory.

No alt text provided for this image


No alt text provided for this image


STEP 10 : Create a S3 bucket and upload some objects there.

COMMAND : aws s3api create-bucket --bucket <Bucket_Name> --region <Region_code> --create-bucket-configurationConstraint=<region_code>
No alt text provided for this image
No alt text provided for this image


STEP 11 : Add an image as an object in the bucket.

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

STEP 12 : Now create a cloud Front distribution with the origin as above bucket .

COMMAND : aws cloudfront create-distribution --origin-domain-name <bucket_name>
No alt text provided for this image
No alt text provided for this image

STEP 13: Add the domain name of the cloud front distribution in the html file 

No alt text provided for this image

Now open the web.html page in browser.

No alt text provided for this image


No alt text provided for this image



Harshita Kumari

DevOps Engineer | Terraform/RHCSA/AWS/Azure Certified | AWS,Docker, Ansible, Kubernetes ,Terraform ,Python ,Jenkins,

4 年

Nice info tejas ??

回复

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

Tejas Gupta的更多文章

  • Ace AWS Cloud Practitioner Certification

    Ace AWS Cloud Practitioner Certification

    Hello Everyone , I recently cleared AWS cloud Practitioner exam and would like to share some learning strategies and…

    6 条评论
  • <script>...</script>

    <script>...</script>

    JavaScript is a dynamic programming language that's used for web development, in web applications, for game…

    1 条评论
  • Confusion Matrix - IDS

    Confusion Matrix - IDS

    A confusion matrix is a summarized table of the number of correct and incorrect predictions (or actual and predicted…

    3 条评论
  • Cisco using MongoDB

    Cisco using MongoDB

    What is MongoDB? MongoDB is a document-oriented NoSQL database used for high volume data storage. Instead of using…

  • Do you know all about vi Editor?

    Do you know all about vi Editor?

    Vi or the Visual Editor is the default text editor that comes with most Linux systems. It is a Terminal-based text…

    9 条评论
  • CISCO WITH OPENSHIFT

    CISCO WITH OPENSHIFT

    Red Hat OpenShift is a multifaceted, open source container application platform from Red Hat Inc. for the development…

  • Industry use cases on Jenkins

    Industry use cases on Jenkins

    What is Jenkins? Jenkins is an open source Continuous Integration server capable of orchestrating a chain of actions…

  • CASE STUDY OF AWS SQS

    CASE STUDY OF AWS SQS

    What is Amazon SQS? Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to…

  • SIEMENS Healthineers With Azure Kubernetes Service (

    SIEMENS Healthineers With Azure Kubernetes Service (

    Lets start with a statistics This itself explain why do we need to have knowledge of Azure Kubernetes Service What is…

  • Facebook with a surprise

    Facebook with a surprise

    The basic idea behind a neural network is to simulate (copy in a simplified but reasonably faithful way) lots of…

社区洞察

其他会员也浏览了