且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

停止AWS EC2实例会自动创建已停止实例的另一个实例

更新时间:2023-10-26 19:03:40

您的最小规模= 1的AutoScaling组启动了一个新实例,因为没有处于运行状态的实例响应请求,特别是健康检查。

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.

如果您的实例存储是临时存储,除非您最近保存了AMI,否则它将永远消失。如果您的实例存储已由EBS支持,则可以通过将EBS卷附加到新实例来恢复它。

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.

对于引导实例:


  • 使用亚马逊提供的标准AMI创建新的启动配置。

  • 添加用户数据到启动配置,以处理所需程序的安装和配置。

  • 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.

用于烘焙 AMI:


  • 安装所需的程序和配置在新的EC2实例上。

  • Ta保留该EC2实例的映像(AMI)。

  • 在新的启动配置中使用该映像。

正如您刚刚发现的那样,在ASG中手动处理实例并期望该实例无限期地存在是很危险的。

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

进一步阅读:

EC2文档-Amazon Machine Images