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

后端 未结 1 1836
自闭症患者
自闭症患者 2021-01-29 08:27

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 instan

1条回答
  •  执笔经年
    2021-01-29 08:55

    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

    0 讨论(0)
提交回复
热议问题