

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

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

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

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

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

**AWS CLI**  
**スタック内のリソースを一覧表示する方法**  
以下のコマンドは、指定されたスタック内にあるリソースを一覧表示します。  

```
aws cloudformation list-stack-resources \
    --stack-name my-stack
```
出力:  

```
{
    "StackResourceSummaries": [
        {
            "LogicalResourceId": "bucket",
            "PhysicalResourceId": "my-stack-bucket-1vc62xmplgguf",
            "ResourceType": "AWS::S3::Bucket",
            "LastUpdatedTimestamp": "2019-10-02T04:34:11.345Z",
            "ResourceStatus": "CREATE_COMPLETE",
            "DriftInformation": {
                "StackResourceDriftStatus": "IN_SYNC"
            }
        },
        {
            "LogicalResourceId": "function",
            "PhysicalResourceId": "my-function-SEZV4XMPL4S5",
            "ResourceType": "AWS::Lambda::Function",
            "LastUpdatedTimestamp": "2019-10-02T05:34:27.989Z",
            "ResourceStatus": "UPDATE_COMPLETE",
            "DriftInformation": {
                "StackResourceDriftStatus": "IN_SYNC"
            }
        },
        {
            "LogicalResourceId": "functionRole",
            "PhysicalResourceId": "my-functionRole-HIZXMPLEOM9E",
            "ResourceType": "AWS::IAM::Role",
            "LastUpdatedTimestamp": "2019-10-02T04:34:06.350Z",
            "ResourceStatus": "CREATE_COMPLETE",
            "DriftInformation": {
                "StackResourceDriftStatus": "IN_SYNC"
            }
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListStackResources](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/list-stack-resources.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: 指定されたスタックに関連付けられているすべてのリソースの説明を返します。**  

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

**Tools for PowerShell V5**  
**例 1: 指定されたスタックに関連付けられているすべてのリソースの説明を返します。**  

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

------