DescribeStackEvents 搭配 使用 CLI - AWS SDK 程式碼範例

文件範例儲存庫中有更多 AWS SDK可用的AWS SDK範例 GitHub 。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

DescribeStackEvents 搭配 使用 CLI

下列程式碼範例示範如何使用 DescribeStackEvents

CLI
AWS CLI

描述堆疊事件

下列describe-stack-events範例顯示指定堆疊的 2 個最近事件。

aws cloudformation describe-stack-events \ --stack-name my-stack \ --max-items 2 { "StackEvents": [ { "StackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/my-stack/d0a825a0-e4cd-xmpl-b9fb-061c69e99204", "EventId": "4e1516d0-e4d6-xmpl-b94f-0a51958a168c", "StackName": "my-stack", "LogicalResourceId": "my-stack", "PhysicalResourceId": "arn:aws:cloudformation:us-west-2:123456789012:stack/my-stack/d0a825a0-e4cd-xmpl-b9fb-061c69e99204", "ResourceType": "AWS::CloudFormation::Stack", "Timestamp": "2019-10-02T05:34:29.556Z", "ResourceStatus": "UPDATE_COMPLETE" }, { "StackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/my-stack/d0a825a0-e4cd-xmpl-b9fb-061c69e99204", "EventId": "4dd3c810-e4d6-xmpl-bade-0aaf8b31ab7a", "StackName": "my-stack", "LogicalResourceId": "my-stack", "PhysicalResourceId": "arn:aws:cloudformation:us-west-2:123456789012:stack/my-stack/d0a825a0-e4cd-xmpl-b9fb-061c69e99204", "ResourceType": "AWS::CloudFormation::Stack", "Timestamp": "2019-10-02T05:34:29.127Z", "ResourceStatus": "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS" } ], "NextToken": "eyJOZXh0VG9XMPLiOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" }
PowerShell
的工具 PowerShell

範例 1:傳回指定堆疊的所有堆疊相關事件。

Get-CFNStackEvent -StackName "myStack"
  • 如需API詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考DescribeStackEvents中的 。