If I used SAM to deploy a stack and later on decided to delete all resources associated with that stack, how would I be able to do that? Because using SAM, sam deploy --stack-name my_lambda_stack --image-repository $MY_AWS_ACCOUNT.dkr.ecr.us-west-2.amazonaws.com/mystack_images
A plain user supplied string is provided as a commandline argument.
But later on, in order to delete the stack with all associated resources using "aws cloudformation" CLI, aws cloudformation delete-stack --stack-name my_lambda_stack
Will not work because it is expecting a unique StackId although the man page is confusing as it is saying Stack Name.
My question is from the user supplied Stack Name, how do I retrieve the corresponding Stack Id using "aws cloudformation list-stacks" or "aws cloudformation describe-stacks"?
Do I have to write a script to parse the output one record at a time?
I understand "aws" CLI has a --query capability but I am at a loss how I could perform wildcard matching and return the matching Stack Id back to me using "aws cloudformation list-stacks --query ..." command.
Any hints would help.
thanks,
Yang cloudformation newbie