Deleting CloudFormation Stacks using a shell script

0

I am writing a shell script to delete a handful stacks using the cli command "aws cloudformation delete-stack --stack-name <stack1>".

When I try to delete the stacks one after the other, only the first one gets deleted and ignores the subsequent stacks. This behavior is precisely same as the management console.

I tried to run each command as a background process in the shell script but the result is still the same. When I delete the stacks one after the other in command prompt it worked fine.

Any thoughts/pointers are appreciated.

AWS
已提問 4 年前檢視次數 1841 次
1 個回答
0
已接受的答案

The solution to this issue is to use Cloudformation's "wait". I have resolved this issue by using "aws cloudformation wait stack-delete-complete --stack-name "$stack" after every stack delete. This works fine within a shell script if you have to delete more than one CloudFormation stack.

AWS
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南