Utilizzare DescribeStackEvents con un o AWS SDK CLI - Esempi di codice dell'AWS SDK

Ci sono altri AWS SDK esempi disponibili nel repository AWS Doc SDK Examples GitHub .

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Utilizzare DescribeStackEvents con un o AWS SDK CLI

I seguenti esempi di codice mostrano come utilizzareDescribeStackEvents.

CLI
AWS CLI

Per descrivere gli eventi dello stack

L'describe-stack-eventsesempio seguente visualizza i 2 eventi più recenti per lo stack specificato.

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
Strumenti per PowerShell

Esempio 1: restituisce tutti gli eventi relativi allo stack per lo stack specificato.

Get-CFNStackEvent -StackName "myStack"

Esempio 2: restituisce tutti gli eventi relativi allo stack per lo stack specificato utilizzando il paging manuale a partire dal token specificato. Il token iniziale per la pagina successiva viene recuperato dopo ogni chiamata con $null che indica che non rimangono altri eventi da recuperare.

$nextToken = $null do { Get-CFNStack -StackName "myStack" -NextToken $nextToken $nextToken = $AWSHistory.LastServiceResponse.NextToken } while ($nextToken -ne $null)