Stopping AWS EC2 instance leads to autocreation of another instance of the stopped one

可紊 提交于 2019-12-04 07:19:54

问题


I had to stop my m3.medium EC2 instance from the AWS console to resize it to m3.large. However, after it stopped, it automatically created a new instance.

Any idea why this is happening? It caused some big troubles for me.


回答1:


Your AutoScaling group with minimum size = 1 spun up a new instance because there were no instances in the 'running' state available to respond to requests, particularly health checks. Your instance was deemed 'unhealthy' and replaced by the ASG.

If your instance storage was ephemeral, I'm afraid it is gone forever unless you recently saved an AMI. If your instance storage was backed by EBS, you can recover it by attaching the EBS volume to a new instance.

In the future, consider configuring your autoscaling group's launch configuration to have everything you need ahead of time, by either bootstrapping the instance or by baking an AMI.

For 'bootstrapping' an instance:

  • Create a new launch configuration with a standard AMI avaialble from Amazon.
  • Add user data to the launch configuration to handle installation and configuration of your desired programs.

For 'baking' an AMI:

  • Install your desired programs and configuration on a new EC2 instance.
  • Take an image (AMI) of that EC2 instance.
  • Use that image in your new launch configuration.

Manually working on an instance within an ASG and expecting the instance to persist indefinitely is dangerous, as you've just discovered.

Further Reading:

  • EC2 Documentation - AutoScaling Health Checks

  • EC2 Documentation - Amazon Machine Images



来源:https://stackoverflow.com/questions/33573620/stopping-aws-ec2-instance-leads-to-autocreation-of-another-instance-of-the-stopp

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