This content originally appeared on DEV Community and was authored by Daberechi
Introduction
Welcome to my latest project where I dive into the world of cloud computing and scalability! In this article, I'll share my experience building a highly available web application on AWS, leveraging services like Autoscaling, Load Balancing, and more. Whether you're a seasoned developer or just starting out, this project showcases the power and flexibility of AWS in creating robust and efficient web infrastructures. Let's dive in and explore the details of this project!
CREATING VPC
- Login to your AWS Management Console
- Search VPC and click on it
- Click create VPC
- Click create VPC and more
- Name your VPC (under auto-generate)
- Let's leave the default IP address in IPV4 CIDR Block
- Select no IPV6 under IPV6 CIDR Block
- Select 2 under number of availability zone
- Select 2 under number of public subnet
- Select 2 under number of private network
- Select 1 per AZ under NAT gateway
- Select none under VPC endpoint
- Click create VPC
LET'S CREATE AUTO SCALING GROUP
- In your AWS Management Console, search for EC2 and click on it
- Scroll down the menu by your left and click on auto scaling group
- Click on create auto scaling
- Name your auto scaling
- Click on create a launch template
- In template version description, put a description of what you want to use the launch template for
- Scroll down, and click on recently launched
- Scroll down to instance type, and select free tier
- If you don't have any key pair, then create a new one. But if you have, select it in your key pair section
- Scroll down to network settings
- Under firewall (security group), select create security group
- Name your security group
- Under description, put allow SSH access
- Click the drop-down menu under VPC and select the VPC you created earlier
- Click on add security group rule
- Under type, select SSH
- Under source type, select anywhere
- Click on add security group rule again
- Under type, select custom TCP
- Under port range, put the port you want (I put 8080 for this project)
- Under source type, I selected anywhere
- Click on add security group again,
- Under type, select http
- the port will automatically be updated (80)
- in source type, select anywhere
- Click on launch template
- After creating, refresh the page
- Then under name ( auto scaling group name) put the name you used while creating the launched template
- Click the drop-down menu on launch template and select the template you created
- Click on next
- Click on the VPC drop-down button and select the VPC you created earlier
- Under availability zone and subnet, select the two private subnet (private 1 and private 2). This is because we want to deploy our server in a private subnet for security purpose.
- Click on next
- Select no load balancer
- Scroll down and click next
- Since we are creating two instances, we will adjust desire capacity to 2
- Adjust maximum capacity to 4
- Select none under scaling policy
- Click next
- Click next if you don't want to add notifications
- Click next
- Click on create auto scaling group
- Now go to your EC2 instance and you will see two instances
- The two instances generated with auto scaling does not have public IP address. This is because we want to deploy our server in a private subnet.
- Since the instances does not have public IP for us to login with, we are going to deploy a Bastion server that we will used to access our instances
CREATING A BASTION SERVER
- Go to your EC2 instance
- Click on launch instance
- Let's name ame it bastion-host
- I'm choosing Ubuntu as image
- Choose free tier as instance type
- Choose your key pair
- Select create security group and make sure you see SSH
- Click on edit in network settings
- Click the VPC drop-down button and select the VPC you created earlier
- Click the drop-down button in auto assign IP, and click enable
- Click on launch instance
CONNECTING TO OUR SERVER PRIVATELY THROUGH OUR BASTION HOST
- Open your terminal ( either AWS cloud shell, AWS CLI, Powershell, Mobaxterm)
- If you are logging in through AWS cloud shell, AWS CLI or Powershell, type ssh -i your key pair.pem Ubuntu@your bastion server public IP
- If you are logging in through mobaxterm, check my previous post to see how to login with mobaxterm
- Once you are logged in copy your key pair to your bastion host by typing scp -i /path/to/your/keypair.pem Ubuntu@bastion host public IP:~/.ssh/ enter (e.g scp -i/user/downloads/aws-login.pem Ubuntu@54.90.58:~/ssh/
- Type yes ( are you sure you want to continue connection)
- Type sudo apt update
- Type ls (this means list)
- Then type ssh -i your key pair.pem Ubuntu@your bastion host private IP, then hit enter ( this shows that you are able to login to your server privately)
- Type yes, enter
- Go to your browser and type w3 schools HTML basic
- Click on HTML basic examples
- Scroll down and click on try it yourself
- Copy the HTML
- Go back to your work, and type vim index.html, hit enter
- Paste the HTML
- Remove where you see my first heading and place it with my first AWS project ( or anything)
- Remove where you see
my first paragraph
remove everything and type:wq! (To save)
- Then type python3 -m http.server 8080 hit enter
LET'S CREATE AN APPLICATION LOAD BALANCER
- Go to your AWS Management Console and search for EC2
- Click on it
- Scroll down the menu by your left and click on load balancer
- Click on create load balancer
- Click on Application load balancer create
- Name it
- Select internet facing
- Select IPV4
- Click the VPC drop-down button and select the two availability zone
- Click on drop-down button under subnet and select public subnet
- Select your security group
- Under listener & routing, click on create target group
- Select instances
- Scroll down to target group name, and name it
- Leave the HTTP, put port 8080 or any port you want
- Click on next
- Select the two instances created with auto scaling. Do no select bastion host instance
- Scroll down and click on include as pending
- Click on create
- Go back to your load balancer
- Under listener and routing, leave protocol at HTTP, and port 8080
- Click the HTTP drop-down button and select the target group you created
- Click on create load balancer
- Navigate to your security
- Click on one of the EC2 instance id
- Scroll down and copy DNS name
- Go to your browser and paste it, then hit enter
We come to the end of today's section
See you soon. Bye
This content originally appeared on DEV Community and was authored by Daberechi

Daberechi | Sciencx (2025-07-05T11:05:04+00:00) Building a Scalable web App on AWS: A Step-by-Step Guide. Retrieved from https://www.scien.cx/2025/07/05/building-a-scalable-web-app-on-aws-a-step-by-step-guide/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.