

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# CLI で `ListStacks` を使用する
<a name="cloudformation_example_cloudformation_ListStacks_section"></a>

次のサンプルコードは、`ListStacks` を使用する方法を説明しています。

------
#### [ CLI ]

**AWS CLI**  
** AWS CloudFormation スタックを一覧表示するには**  
以下の `list-stacks` コマンドは、ステータスが `CREATE_COMPLETE` になっているすべてのスタックの概要を表示します。  

```
aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE
```
出力:  

```
[
    {
        "StackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/myteststack/466df9e0-0dff-08e3-8e2f-5088487c4896",
        "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"
    }
]
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListStacks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/list-stacks.html)」を参照してください。

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**例 1: すべてのスタックの概要情報を返します。**  

```
Get-CFNStackSummary
```
**例 2: 現在作成中のすべてのスタックの概要情報を返します。**  

```
Get-CFNStackSummary -StackStatusFilter "CREATE_IN_PROGRESS"
```
**例 3: 現在作成中または更新中のすべてのスタックの概要情報を返します。**  

```
Get-CFNStackSummary -StackStatusFilter @("CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS")
```
+  API の詳細については、「*AWS Tools for PowerShell Cmdlet Reference (V4)*」の「[ListStacks](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: すべてのスタックの概要情報を返します。**  

```
Get-CFNStackSummary
```
**例 2: 現在作成中のすべてのスタックの概要情報を返します。**  

```
Get-CFNStackSummary -StackStatusFilter "CREATE_IN_PROGRESS"
```
**例 3: 現在作成中または更新中のすべてのスタックの概要情報を返します。**  

```
Get-CFNStackSummary -StackStatusFilter @("CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS")
```
+  API の詳細については、「*AWS Tools for PowerShell Cmdlet Reference (V5)*」の「[ListStacks](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------