使用Java SDK在ELB中停止EC2实例 [英] Stopping EC2 instance in an ELB using java sdk
问题描述
我有一组在ELB中运行的实例和一个API,用于停止/启动使用Java SDK开发的所有这些实例.
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?
推荐答案
如果实例与自动伸缩组相关联,则会终止实例
Instances are terminated if they are associated with an auto scaling group
为此自动缩放组中的实例终止进行检查更多细节.
Check this Instance Termination in autoscaling groups for more details.
您可以使用AWS JAVA SDK将实例与自动扩展组分离
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.
如果未指定减少所需容量的选项,则Auto Scaling会启动实例以替换分离的实例.所以请记住这一点.
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.
这篇关于使用Java SDK在ELB中停止EC2实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!