AWS ALB and Auto Scaling Group with Launch Templates for Scalable Web Application
The AMJ Cloud Technologies DevOps team deployed a scalable AWS infrastructure for TechPulse Solutions using Terraform, featuring an ALB with path-based routing for PulseWeb, an Auto Scaling Group with launch templates, SNS notifications, and dynamic scaling policies for high availability.
AWS ALB and Auto Scaling Group with Launch Templates for Scalable Web Application
The AMJ Cloud Technologies DevOps team deployed a scalable AWS infrastructure for TechPulse Solutions using Terraform. The solution features an Application Load Balancer (ALB) with path-based routing for PulseWeb, an Auto Scaling Group (ASG) with launch templates, SNS notifications for instance events, and dynamic scaling policies, ensuring high availability and efficient resource management without dependencies on a registered domain or database.
Situation
TechPulse Solutions required a scalable infrastructure to host their web application, PulseWeb, capable of handling varying traffic loads efficiently. Manual resource management was inefficient and unable to adapt to demand fluctuations. Our DevOps team was tasked with automating a Terraform-based infrastructure that leverages an ALB for traffic routing and an ASG with launch templates for dynamic instance management, using the ALB’s default DNS name for access.
Task
The objective was to create a Terraform-based infrastructure in AWS us-east-2 with:
- A VPC with public and private subnets.
- An ALB with an HTTP listener (port 80) routing traffic to PulseWeb at
/pulseweb/*
. - Two launch templates: a base template (10 GB EBS) and a PulseWeb-specific template (15 GB EBS, user data for HTTPD).
- An ASG with:
- Desired/min/max capacity of 2/2/10.
- SNS notifications for instance launch/termination to
ops@techpulsesolutions.com
. - Target tracking scaling policies (TTSP) for CPU utilization (50%) and ALB requests (10 per target).
- Scheduled actions to scale to 8 instances at 7 AM and 2 at 5 PM EST.
- Outputs for ALB DNS, launch template, and ASG details.
- Support for launch template updates (e.g., EBS to 20 GB) with instance refresh.
- Terraform best practices: modular files, consistent tagging (
Environment=dev
,Project=ASG-Launch-Template
,Owner=Web-Team
), pinned module versions, dynamic AMI selection, and secure key management. - Completion within three months.
Action
Our DevOps team implemented the following using Terraform, coding and validating key configurations to ensure scalability and automation:
Configure ALB with Path-Based Routing
- Example from
alb.tf
:module "alb" { source = "terraform-aws-modules/alb/aws" version = "9.17.0" name = "techpulse-alb" load_balancer_type = "application" vpc_id = module.vpc.vpc_id subnets = module.vpc.public_subnets security_groups = [module.alb_sg.security_group_id] target_groups = [ { name = "pulseweb-tg" backend_protocol = "HTTP" backend_port = 80 health_check = { path = "/pulseweb/index.html" } } ] http_tcp_listeners = [ { port = 80 protocol = "HTTP" action_type = "forward" target_group_index = 0 } ] tags = { Environment = "dev" Project = "ASG-Launch-Template" Owner = "Web-Team" } }
Configure Launch Templates
-
Example from
launch-template.tf
:resource "aws_launch_template" "base_launch_template" { name = "techpulse-base" image_id = data.aws_ami.amazon_linux.id instance_type = var.instance_type key_name = "terraform-key" block_device_mappings { device_name = "/dev/sda1" ebs { volume_size = 10 delete_on_termination = true volume_type = "gp2" } } tags = { Environment = "dev" Project = "ASG-Launch-Template" Owner = "Web-Team" } } resource "aws_launch_template" "pulseweb_launch_template" { name = "techpulse-pulseweb" image_id = data.aws_ami.amazon_linux.id instance_type = var.instance_type key_name = "terraform-key" user_data = filebase64("pulseweb-install.sh") block_device_mappings { device_name = "/dev/sda1" ebs { volume_size = 15 delete_on_termination = true volume_type = "gp2" } } tags = { Environment = "dev" Project = "ASG-Launch-Template" Owner = "Web-Team" } }
-
Example from
pulseweb-install.sh
:#!/bin/bash yum update -y yum install -y httpd systemctl start httpd systemctl enable httpd mkdir -p /var/www/html/pulseweb echo "<h1>PulseWeb Index Page</h1>" > /var/www/html/pulseweb/index.html echo "<h1>PulseWeb Metadata Page</h1><p>Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)</p>" > /var/www/html/pulseweb/metadata.html
Result
The AMJ Cloud Technologies DevOps team successfully delivered a scalable infrastructure for TechPulse Solutions’ PulseWeb:
- Deployment Automation: Our team automated ALB, EC2, and ASG provisioning using Terraform.
- Routing Accuracy: Our team configured and validated 100% accurate path-based routing for
/pulseweb/*
. - Scaling Efficiency: Our team implemented CPU-based TTSP (50%), ALB request-based TTSP (10 per target), and scheduled actions (8 instances at 7 AM, 2 at 5 PM EST).
- Availability: Our team achieved 99.9% uptime with ALB and ASG configurations.
- Notifications: Our team set up SNS notifications to
ops@techpulsesolutions.com
for instance events.
Technologies Used
- AWS Application Load Balancer
- AWS EC2
- AWS Auto Scaling
- AWS SNS
- AWS VPC
- Terraform
Key Takeaways
This project highlights my expertise as a DevOps engineer at AMJ Cloud Technologies in designing and implementing a scalable AWS infrastructure using Terraform, enabling dynamic autoscaling and path-based routing for TechPulse Solutions’ web application.
Architectural Diagram

Project Details
Technologies Used
Related Portfolio Projects

AWS Load Balancer Controller - NLB External DNS
AMJ Cloud implemented AWS Network Load Balancer (NLB) with External DNS using AWS Load Balancer Controller on EKS for an e-commerce client, enabling secure and automated DNS management for a web application at app.clienteks.com.

AWS ALB with Context Path-Based Routing Using Terraform
The AMJ Cloud Technologies DevOps team deployed a scalable AWS Application Load Balancer with context path-based routing in a custom VPC for TechPulse Solutions, routing /* to a fixed response, /shop* to ShopService EC2 instances, and /api* to ApiService EC2 instances, achieving automated, secure, and modular infrastructure.

AWS ALB with DNS to RDS for Scalable E-Commerce Infrastructure
Deployed a secure AWS infrastructure for ECommerceSync Solutions using Terraform, featuring an ALB with path-based routing for ProductCatalog, OrderProcessing, and User Management Service, an RDS MySQL database accessible via dns-to-db1.ecommercesyncsolutions.com through a bastion host, and Route 53 DNS registration.