Stopping EC2 instance in an ELB using java sdk

2019-08-22 00:48发布

I have a set of instances running within an ELB and an API to stop/ start any of those instance developed using java SDKs.

However the instances are getting terminated as soon as it goes to stopped state, which i don't want to happen. Is this a known behavior and is there a way to stop this from happening and to keep these instances in the stopped state?

1条回答
Juvenile、少年°
2楼-- · 2019-08-22 01:32

Instances are terminated if they are associated with an auto scaling group

Check this Instance Termination in autoscaling groups for more details.

You can detach the instance from the autoscaling group using the AWS JAVA SDK

Detatch Instances Request Detach them first and then stop the instance to prevent termination.

If you do not specify the option to decrement the desired capacity, Auto Scaling launches instances to replace the ones that are detached. So keep that in mind.

查看更多
登录 后发表回答