Create Auto Scaling Group
Create Auto Scaling Group
-
In interfatce of EC2, choose Auto scaling group at sidebar, then click Create auto scaling group.
-
In the interface of creating ASG:
- Name fill in
AppTierASG
- Launch template choose AppTier-LaunchTemplate
- Scroll downw and click Next
-
In the interface of configuring Network:
- VPC: my-vpc
- AZs and subnets choose Private Subnet 1 and Private Subnet 2
- Click Next
-
In the next configuration interface:
- Load balancing choose Attach to an existing load balancer
- Choose Choose from your load balancer target group then choose AppTierTargetGroup
- Scroll downw and click Next
-
In the next configuration interface:
- Desired capacity: 2
- Min desired capacity: 2
- Max desired capacity: 2
- Scroll downw and click Next
- Next to the last step then click Create auto scaling group
-
Finish creating ASG:
-
After creating ASG successfully, 2 new ec2 instances will be created:
→ Now we have 3 ec2 instances, now we can terminate the My App Server 1 instance (but recommend to keep it for easy troubleshooting later)
→If terminate any instance in ASG, the new instance will be launched by ASG immediately
- Try to terminate both instances in ASG, 2 new instances will be launched immediately by ASG