Tools: πŸš€ Deploying a Highly Available Web Application on AWS using ALB & Auto Scaling (Beginner-Friendly)

Tools: πŸš€ Deploying a Highly Available Web Application on AWS using ALB & Auto Scaling (Beginner-Friendly)

Source: Dev.to

!/bin/bash ## Welcome from ALB + Auto Scaling ## Hostname: $(hostname) In this hands-on project, I built a production-ready AWS architecture using core services like VPC, Application Load Balancer, Auto Scaling Group, EC2, and NAT Gateway. This setup follows AWS best practices: Zero public access to EC2 instances This guide is beginner-friendly, yet interview-ready. 🧠 What You Will Learn βœ… How to design a secure AWS VPC βœ… Public vs Private Subnets (real use-case) βœ… Application Load Balancer (ALB) βœ… Auto Scaling Group (ASG) βœ… NAT Gateway for outbound internet βœ… Real-world architecture used in companies πŸ—οΈ Architecture Overview Internet | β–Ό Application Load Balancer (Public Subnets) | β–Ό Target Group | β–Ό Auto Scaling Group (EC2 Instances in Private Subnets) | β–Ό NAT Gateway β†’ Internet (Outbound Only) πŸ”’ EC2 instances have NO public IPs 🌐 Only ALB is exposed to the internet Application Load Balancer 🚦 Step-by-Step Implementation 1️⃣ Create a Custom VPC Public-Subnet-1 (ALB) Public-Subnet-2 (NAT Gateway) Private-Subnet-1 (EC2) Private-Subnet-2 (EC2) ⚠️ Enable Auto-assign Public IP = YES only for public subnets Create and attach an Internet Gateway to the VPC Required for ALB and NAT Gateway 4️⃣ NAT Gateway (CRITICAL) Create NAT Gateway in public subnet Allows private EC2 to access internet securely 0.0.0.0/0 β†’ Internet Gateway 0.0.0.0/0 β†’ NAT Gateway Associate correctly with subnets. 6️⃣ Security Groups πŸ”Ή ALB Security Group HTTP (80) β†’ 0.0.0.0/0 πŸ”Ή EC2 Security Group HTTP (80) β†’ ALB Security Group SSH (22) β†’ Your IP (optional) πŸ” EC2 is accessible only via ALB 7️⃣ Launch Template (EC2) AMI: Ubuntu 22.04 Instance Type: t2.micro apt update -y apt install apache2 -y systemctl start apache2 systemctl enable apache2 Target Type: Instance 9️⃣ Application Load Balancer Type: Internet-facing Subnets: Public Subnets Forward to Target Group πŸ”Ÿ Auto Scaling Group Subnets: Private Subnets Attach to ALB Target Group πŸ“ˆ Optional: CPU-based scaling policy Refresh multiple times πŸŽ‰ You will see different hostnames This confirms: πŸ”— Project Source Code & Documentation πŸ‘‰ https://github.com/IrfanPasha05/aws-alb-autoscaling-project Troubleshooting guide 🎯 Why This Project Matters This architecture is used in: Real production environments Enterprise applications DevOps & Cloud Engineer roles 🧩 Future Enhancements Custom domain (Route 53) Monitoring with CloudWatch This project strengthened my understanding of AWS networking, security, and scalability. If you’re learning AWS or preparing for cloud roles β€” build this once, and you’ll remember it forever. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse