There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ListStacks with a CLI
The following code examples show how to use ListStacks.
- CLI
-
- AWS CLI
-
To list AWS CloudFormation stacks
The following
list-stacksexample shows a summary of all stacks that have a status ofCREATE_COMPLETE.aws cloudformation list-stacks \ --stack-status-filterCREATE_COMPLETEOutput:
{ "StackSummaries": [ { "StackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/myteststack/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "TemplateDescription": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create a publicly accessible S3 bucket. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.", "StackStatusReason": null, "CreationTime": "2013-08-26T03:27:10.190Z", "StackName": "myteststack", "StackStatus": "CREATE_COMPLETE" } ] }For more information, see Managing AWS resources as a single unit with CloudFormation stacks in the AWS CloudFormation User Guide.
-
For API details, see ListStacks
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: Returns summary information for all stacks.
Get-CFNStackSummaryExample 2: Returns summary information for all stacks that are currently being created.
Get-CFNStackSummary -StackStatusFilter "CREATE_IN_PROGRESS"Example 3: Returns summary information for all stacks that are currently being created or updated.
Get-CFNStackSummary -StackStatusFilter @("CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS")-
For API details, see ListStacks in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: Returns summary information for all stacks.
Get-CFNStackSummaryExample 2: Returns summary information for all stacks that are currently being created.
Get-CFNStackSummary -StackStatusFilter "CREATE_IN_PROGRESS"Example 3: Returns summary information for all stacks that are currently being created or updated.
Get-CFNStackSummary -StackStatusFilter @("CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS")-
For API details, see ListStacks in AWS Tools for PowerShell Cmdlet Reference (V5).
-