gpt4 book ai didi

amazon-web-services - 无法彻底删除数据堆栈中带有 AWS::EC2::VolumeAttachment 到磁盘的工作堆栈

转载 作者:行者123 更新时间:2023-12-03 07:37:49 29 4
gpt4 key购买 nike

我有两个堆栈:myDatamyWorker。工作人员使用数据。删除工作人员时出现错误。这些错误表明他对数据的附件仍然有效。

myData 生命周期很长,包含 myVolume,一个 AWS::EC2::Volume

myWorker 仅偶尔存在,包含 myServermyMountPoint、一个 AWS::EC2::InstanceAWS::EC2::VolumeAttachment

这行不通。 myWorker 报告上的 delete-stack:

DELETE_FAILED Volume detachment between volume-id vol-XXXX and instance-id i-YYYY at device /dev/sdX is in busy state

这似乎很合理。顺序大概是:

create myWorker
create myServer
create myMountPoint
... later ...
delete-stack myWorker
delete myMountPoint
delete myServer

在这种情况下,服务器仍在运行并且可能正在使用安装点。

但这似乎不太可能。

create myWorker
create myServer
create myMountPoint
start up myServer
mount that mount point
start services including disk mounting
... later ...
delete-stack myWorker
stop up myServer
stop services & unmount disk
delete myMountPoint
delete myServer

那么,帮忙吗?这个序列实际记录在哪里,我该如何解决这个问题?

最佳答案

Where is this sequence actually documented [...]

AWS::EC2::VolumeAttachment您所描述的行为已在资源的 CloudFormation 文档的开头注明:

Important

Before this resource can be deleted (and therefore the volume detached), you must first unmount the volume in the instance. Failure to do so results in the volume being stuck in the busy state while it is trying to detach, which could possibly damage the file system or the data it contains.

If an Amazon EBS volume is the root device of an instance, it cannot be detached while the instance is in the "running" state. To detach the root volume, stop the instance first.


[...] and how can I fix this?

对于像您这样的典型用例,其中 EC2 实例在实例的整个生命周期中使用附加的 EBS 卷,您可以使用 Volumes 声明您的 EBS 卷附件。属性 AWS::EC2::Instance资源而不是单独的AWS::EC2::VolumeAttachment资源。 Volumes 属性可让实例在从 EC2 实例分离之前先正确关闭(卸载任何已安装的卷是关闭过程的一部分)。

关于amazon-web-services - 无法彻底删除数据堆栈中带有 AWS::EC2::VolumeAttachment 到磁盘的工作堆栈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36248833/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com