Terraform 在终止后继续旋转实例?
Terraform keeps spinning up instances after termination?
我写了一个 terraform 脚本来启动一个 EC2 spot 实例,每次我终止它时,它都会自动启动一个新实例。我不明白这种行为。为什么会发生这种情况,我该如何阻止它?
当您请求 spot 实例时,您可能没有将 spot-type 指定为 'one-time',因此请求在实例终止后仍然存在。或者换句话说,当您的实例终止时,请求会重新开始并根据相同的出价、启动规范等启动新实例。
spot_type - (Optional; Default: "persistent") If set to "one-time",
after the instance is terminated, the spot request will be closed.
Also, Terraform can't manage one-time spot requests, just launch them.
这将一直持续到您取消 spot 实例请求为止。您可以通过 AWS 控制台、CLI (cancel-spot-instance-requests), or via terraform by destroying the resource.
进一步阅读
我写了一个 terraform 脚本来启动一个 EC2 spot 实例,每次我终止它时,它都会自动启动一个新实例。我不明白这种行为。为什么会发生这种情况,我该如何阻止它?
当您请求 spot 实例时,您可能没有将 spot-type 指定为 'one-time',因此请求在实例终止后仍然存在。或者换句话说,当您的实例终止时,请求会重新开始并根据相同的出价、启动规范等启动新实例。
spot_type - (Optional; Default: "persistent") If set to "one-time", after the instance is terminated, the spot request will be closed. Also, Terraform can't manage one-time spot requests, just launch them.
这将一直持续到您取消 spot 实例请求为止。您可以通过 AWS 控制台、CLI (cancel-spot-instance-requests), or via terraform by destroying the resource.