Create High Availability Architecture with AWS CLI – including webserver configuration EBS, S3 & CloudFront & their Integration..!

Published by Rajneesh Pratap Singh on

configuration of these services on the top of AWS using CLI

what are we going to perform in this article ?

  • 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 a S3 bucket.
  •  Finally, place the Cloud Front URL on the web app code for security and low latency.


  • Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 services such as compute, databases, and storage.
  • AWS offers low, pay-as-you-go pricing with no up-front expenses or long-term commitments. We are able to build and manage a global infrastructure at scale and pass the cost-saving benefits onto you in the form of lower prices.

okay so now we have a little idea about aws and aws cloufront so let’s start the task…

  • start an instance on AWS first-

we have started our instance now its time to perform the rest of the practical-

  • Now attach this volume to the instance 

  • above pictures clearly showing that we have successfully attached our EBS volume to the instance.
  • we can also check from the system, as mentioned in the image below.


  • now we are going to create a partition of some size in the harddisk (EBS VOLUME)-

  • now we have to format the partition in order to store data in it.

  • last step is to mount the formatted partition to /var/www/html/ directory it will help you in the setting up the webserver.

now we have to configure websever on the top of aws .

  1. install httpd software using yum install httpd . i(f now installed )
  2. start the webserver using systemctl start httpd command.

3. now create a html file inside the /var/www/html directory

4. now disable the selinux security because it will cause an error while connecting to the webpage.

    5. now let’s enter your public IP and file name as URL to check your web server is working or not, in my case:

  1.       it’s working good now we have to and image in this for this we need to do some other things as mentioned in the task.

now we are going to create a s3 bucket and store the file into it. 

  • i have created a bucket, you might face error while creating this so I suggest to change the name of your bucket. and then try again

we can also verify on GUI. let’s have a look.

now make the file public so that browser can reach to it .

  • using the object url anyone can now open the image file stored in the bucket.
  • now use this url into your html code and enjoy the bucket service.

  • as you can see the html code with the object url is working good.

last step of this task is to Create CloudFront Distribution & Integrate with S3 & Web Server ?

  • 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.

let’s create a distribution first.

  • we can also verify from GUI .

  • Domain Name(CloudFront URL) — Used to access the data from Edge Locations with less latency & high network speed.


now edit again the html file use the domain url with image name to provide low latency to your clients. in my case ths url is – “https://”

  • CloudFront also provides a statistical report to server side to know the behaviour of clients towards their services. Below I have attached an image for a brief idea.

i hope u learner a lot by this article if u r facing any issue then kindly ping me on LinkedIn.

thank you, happy_learning.

For the study stuff of all standards visit our website BrighterBees.


Leave a Reply

Your email address will not be published. Required fields are marked *