AWS 文档 SDK 示例
将 ListStackResources 与 CLI 配合使用
以下代码示例演示如何使用 ListStackResources。
- CLI
-
- AWS CLI
-
列出堆栈中的资源
以下命令显示指定堆栈中的资源列表。
aws cloudformation list-stack-resources \ --stack-namemy-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
。
-
- PowerShell
-
- Tools for PowerShell V4
-
示例 1:返回与指定堆栈关联的所有资源的描述。
Get-CFNStackResourceSummary -StackName "myStack"-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference(V4)》中的 ListStackResources。
-
- Tools for PowerShell V5
-
示例 1:返回与指定堆栈关联的所有资源的描述。
Get-CFNStackResourceSummary -StackName "myStack"-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference(V5)》中的 ListStackResources。
-
GetTemplate
ListStacks