Stopping EC2 instance in an ELB using java sdk

亡梦爱人 提交于 2019-12-25 03:15:57

问题


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:


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.



来源:https://stackoverflow.com/questions/50128185/stopping-ec2-instance-in-an-elb-using-java-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!