AWS AutoScallingGroupの削除に失敗する
Page content
AutoScallingGroupのスタック削除で少々詰まったので備忘録。
やったこと
AWS::AutoScaling::AutoScalingGroupのCloudformationスタックを立て、EC2 Instanceを管理。
aws cloudformation create-stack --stack-name MyStackName --template-body file://mytemplate.yml...
Resources:
AutoScalingGroupJmeter:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
...使い終わって、Instanceの利用料金がもったいないのでsuspend(中断)。
aws autoscaling suspend-processes --auto-scaling-group-name MyAsgNameその後も使うことが無さそうなので、スタックを削除。
aws cloudformation delete-stack --stack-name MyStackName現象
以下のメッセージが出て削除に失敗しました。
AutoscalingGroup deletion cannot be performed because the Terminate process has been suspended; please resume this process and then retry stack deletion.原因
suspend-processesを実行する際、特にプロセスを指定しなかったので、全てのプロセスがsuspendされた。
このためTerminateもsuspendされてしまい、削除に失敗。
解決策
Terminateだけresume(再開)すれば、削除に成功する。
aws autoscaling resume-processes --auto-scaling-group-name MyAsgName --scaling-processes Terminate

