AWS Three-Tier Architecture: Internal Load Balancing and Auto Scaling

Table of Contents

  1. App Tier AMI
  2. Target Group
  3. Internal Load Balancer
  4. Launch Template
  5. Auto Scaling
  6. Conclusion

App Tier AMI

  1. Navigate to Instances in the EC2 dashboard.
  2. Select the app tier instance we created.
  3. Under Actions, choose Image and templates > Create Image.
  4. Give the image a name and description, then click Create Image.
  5. Monitor the AMI creation status under AMIs in the EC2 dashboard.

Target Group

  1. While the AMI is being created, navigate to Target Groups under Load Balancing in the EC2 dashboard.
  2. Click Create Target Group.
  3. Select Instances as the target type and provide a name.
  4. Set:
    • Protocol: HTTP
    • Port: 4000 (port our Node.js app runs on)
    • VPC: Select the existing one
    • Health Check Path: /health
  5. Click Next and skip target registration for now.
  6. Click Create Target Group.

Internal Load Balancer

  1. Navigate to Load Balancers under Load Balancing in the EC2 dashboard.
  2. Click Create Load Balancer.
  3. Select Application Load Balancer.
  4. 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
  5. Click Create Load Balancer.

Launch Template

  1. Navigate to Launch Template under Instances in the EC2 dashboard.
  2. Click Create Launch Template.
  3. 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
  4. Click Create Launch Template.

Auto Scaling

  1. Navigate to Auto Scaling Groups in the EC2 dashboard.
  2. Click Create Auto Scaling Group.
  3. Provide a name and select the created Launch Template.
  4. Configure:
    • VPC: Select the existing VPC
    • Private Instance Subnets: Choose the app tier subnets
  5. Attach the Auto Scaling Group to the Load Balancer:
    • Select the existing Target Group
  6. Set scaling policies:
    • Desired Capacity: 2
    • Minimum Capacity: 2
    • Maximum Capacity: 2
  7. 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

Image description

Image description

Target Group

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Internal LoadBalancer

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Launch Template
Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Auto Scaling

Image description

Image description

Image description

Image description