AWS CloudFormation Stack Deletion History

CloudFormation Stack Deletion History

Prev Question Next Question

Question

You have several Cloudformation stacks in your IT organization.

Which of the following command will help you see all the cloudformation stacks that have been deleted three months earlier?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B.

The following is the description of the list-stacks command.

Returns the summary information for stacks whose status matches the specified StackStatusFilter.

Summary information for stacks that have been deleted is kept for 90 days after the stack is deleted.

If no stack-status-filter is specified, summary information for all stacks is returned (including existing stacks and stacks that have been deleted).

For more information on the list-stacks command, please visit the below link.

http://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-stacks.html

The correct answer is B. list-stacks.

The list-stacks command is used to list all the stacks in your account, including those that have been deleted. To see the deleted stacks, you can use the optional parameter --stack-status-filter with the value DELETE_COMPLETE, which will filter the results to show only the stacks that have been deleted.

For example, the following command will list all the stacks that have been deleted three months earlier:

perl
aws cloudformation list-stacks --stack-status-filter DELETE_COMPLETE --query "StackSummaries[?DeletionTime>='$(date --date='3 months ago' --utc +%Y-%m-%dT%H:%M:%S)']"

This command uses the --query parameter to filter the results to show only the stacks that have a DeletionTime timestamp that is greater than or equal to the current date minus three months. The timestamp format is in ISO 8601 format.

Option A, describe-stacks, is used to get information about a specific stack, but it cannot be used to list all the stacks, including deleted ones.

Option C, stacks-complete, is not a valid AWS CloudFormation command.

Option D, list-templates, is used to list all the templates in your account, but it cannot be used to list the stacks, including deleted ones.