I want to invoke a Lambda function like the input is if my primary zone went down, lambda function invokes automatically and create the ec2 instances through auto scaling group in secondary zone.
Asked
Active
Viewed 392 times
1 Answers
1
Amazon EC2 Auto Scaling will automatically replace EC2 instances if they fail or if an Availability Zone becomes unavailable.
When creating the Auto Scaling group, specify multiple AZs. The EC2 instances will be balanced between the AZs. For example, if there are 2 instances and 2 AZs, then Auto Scaling will deploy one instance in each AZ. If an AZ should fail, a replacement instance will automatically be launched in the remaining AZ.
There is no need to use an AWS Lambda function to achieve this automatic scaling.

John Rotenstein
- 241,921
- 22
- 380
- 470
-
Hi @John Rotenstein, thanks for your reply. So in my case if my primary site went down, i want automatically launch the autoscaling group with new configurations in second site.could you please advise on this – Harish Devarapalli Mar 01 '21 at 08:25
-
I suspect we have a difference in terminology, so I'll try to explain in more detail. First, you can launch an Auto Scaling group and tell it how many instances you want, and in which AZs. Auto Scaling then launches the instance(s) for you. Then, if one of those instances (or an AZ) should fail, Auto Scaling will automatically launch a replacement instance. It's not so much a "second site" as a replacement for the capacity that was lost. If your app allows, you can actually use multiple instances so that, if one fails, the application continues to operate while the new instance launches. – John Rotenstein Mar 01 '21 at 08:41