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
asked 3 years ago1784 views
1 Answer
0
Accepted Answer

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
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions