AWS Three-Tier Architecture: Internal Load Balancing and Auto Scaling
Table of Contents
App Tier AMI
- Navigate to Instances in the EC2 dashboard.
- Select the app tier instance we created.
- Under Actions, choose Image and templates > Create Image.
- Give the image a name and description, then click Create Image.
- Monitor the AMI creation status under AMIs in the EC2 dashboard.
Target Group
- While the AMI is being created, navigate to Target Groups under Load Balancing in the EC2 dashboard.
- Click Create Target Group.
- Select Instances as the target type and provide a name.
- Set:
- Protocol: HTTP
- Port: 4000 (port our Node.js app runs on)
- VPC: Select the existing one
-
Health Check Path:
/health
- Click Next and skip target registration for now.
- Click Create Target Group.
Internal Load Balancer
- Navigate to Load Balancers under Load Balancing in the EC2 dashboard.
- Click Create Load Balancer.
- Select Application Load Balancer.
- Set:
- Name: Enter a name
- Scheme: Internal (as this is not public-facing)
- Network Configuration: Select the correct VPC and private subnets
- Security Group: Use the one created for this internal ALB
- Listener: HTTP on port 80
- Target Group: Select the one created earlier
- Click Create Load Balancer.
Launch Template
- Navigate to Launch Template under Instances in the EC2 dashboard.
- Click Create Launch Template.
- Set:
- Name: Enter a name
- Application and OS Images: Select the created app tier AMI
-
Instance Type:
t2.micro
- Key Pair & Network Settings: Do not include (not needed for access)
- Security Group: Select the one for the app tier
- IAM Instance Profile: Use the same IAM role as previous EC2 instances
- Click Create Launch Template.
Auto Scaling
- Navigate to Auto Scaling Groups in the EC2 dashboard.
- Click Create Auto Scaling Group.
- Provide a name and select the created Launch Template.
- Configure:
- VPC: Select the existing VPC
- Private Instance Subnets: Choose the app tier subnets
- Attach the Auto Scaling Group to the Load Balancer:
- Select the existing Target Group
- Set scaling policies:
- Desired Capacity: 2
- Minimum Capacity: 2
- Maximum Capacity: 2
- Click Next, Next, then Create Auto Scaling Group.
Conclusion
This completes the internal load balancing and auto-scaling setup for the AWS three-tier architecture. Your app tier is now configured to scale automatically and distribute traffic efficiently.
Continue to the next Part AWS Three-Tier Architecture (Part-6)
Internal Load Balancing and Auto Scaling
App Tier AMI
Target Group
Internal LoadBalancer
Launch Template
Auto Scaling