I'm building up to a larger AWS CLI job but one of the building blocks is stumping me;
How do I get a list of just the names of every currently running AWS Cloudformation stack?
I can list the stacks just fine with the following, but I can't get a query to pair it down to just the stack name.
aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE --output text
I could cut the resulting table down in bash, but I'd love a more elegant aws solution if it exists.
You can add the query parameter to that same query to narrow the result set to only the StackName.
Per @idbehold, you will also need to include all stack status filters except for CREATE_FAILED
and DELETE_COMPLETE
to truly capture all current stacks. These only need to be delimited by spaces.
Query:
"StackSummaries[*].StackName"
Full Example:
aws cloudformation list-stacks --stack-status-filter CREATE_IN_PROGRESS CREATE_COMPLETE ROLLBACK_IN_PROGRESS ROLLBACK_FAILED ROLLBACK_COMPLETE DELETE_IN_PROGRESS DELETE_FAILED UPDATE_IN_PROGRESS UPDATE_COMPLETE_CLEANUP_IN_PROGRESS UPDATE_COMPLETE UPDATE_ROLLBACK_IN_PROGRESS UPDATE_ROLLBACK_FAILED UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS UPDATE_ROLLBACK_COMPLETE REVIEW_IN_PROGRESS --query "StackSummaries[*].StackName"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With