我正在使用 CloudFormation 创建我的环境。堆栈的一部分包括从快照创建卷,将其与 EC2 实例关联,然后挂载它。
"Resources" : {
"EBSData" : {
"Type" : "AWS::EC2::Volume",
...snip...
},
"MountPoint" : {
"Type" : "AWS::EC2::VolumeAttachment",
...snip...
},
"myTestInstance" : {
"Type" : "AWS::EC2::Instance",
...snip...
}
},
当我尝试调用 delete-stack 时,它失败了,因为该卷仍然挂载:
"StackStatusReason": "The following resource(s) failed to delete: [EBSData, MountPoint].",
"CreationTime": "2013-12-03T13:40:58.646Z",
"StackName": "myTestStack",
"StackStatus": "DELETE_FAILED",
"DisableRollback": false
第二次调用 delete-stack 成功,因为实例已经被销毁。
正在运行的实例中是否有任何被 cloudformation delete-stack 调用的挂钩,我可以在其中卸载卷?还有其他方法可以做到这一点吗?