DescribeAutomationExecutions与 a 一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DescribeAutomationExecutions与 a 一起使用 CLI

以下代码示例演示如何使用 DescribeAutomationExecutions

CLI
AWS CLI

描述自动化执行

以下 describe-automation-executions 示例显示了有关自动化执行的详细信息。

aws ssm describe-automation-executions \ --filters Key=ExecutionId,Values=73c8eef8-f4ee-4a05-820c-e354fEXAMPLE

输出:

{ "AutomationExecutionMetadataList": [ { "AutomationExecutionId": "73c8eef8-f4ee-4a05-820c-e354fEXAMPLE", "DocumentName": "AWS-StartEC2Instance", "DocumentVersion": "1", "AutomationExecutionStatus": "Success", "ExecutionStartTime": 1583737233.748, "ExecutionEndTime": 1583737234.719, "ExecutedBy": "arn:aws:sts::29884EXAMPLE:assumed-role/mw_service_role/OrchestrationService", "LogFile": "", "Outputs": {}, "Mode": "Auto", "Targets": [], "ResolvedTargets": { "ParameterValues": [], "Truncated": false }, "AutomationType": "Local" } ] }

有关更多信息,请参阅《AWS Systems Manager 用户指南》中的运行简单的自动化工作流程

PowerShell
用于 PowerShell

示例 1:此示例描述与您的账户关联的所有活动和已终止的自动化执行。

Get-SSMAutomationExecutionList

输出:

AutomationExecutionId : 4105a4fc-f944-11e6-9d32-8fb2db27a909 AutomationExecutionStatus : Failed DocumentName : AWS-UpdateLinuxAmi DocumentVersion : 1 ExecutedBy : admin ExecutionEndTime : 2/22/2017 9:17:08 PM ExecutionStartTime : 2/22/2017 9:17:02 PM LogFile : Outputs : {[createImage.ImageId, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]]}

示例 2:此示例显示了 “成功” 以外的执行的 executionID、文档、执行开始/结束时间戳 AutomationExecutionStatus

Get-SSMAutomationExecutionList | Where-Object AutomationExecutionStatus -ne "Success" | Select-Object AutomationExecutionId, DocumentName, AutomationExecutionStatus, ExecutionStartTime, ExecutionEndTime | Format-Table -AutoSize

输出:

AutomationExecutionId DocumentName AutomationExecutionStatus ExecutionStartTime ExecutionEndTime --------------------- ------------ ------------------------- ------------------ ---------------- e1d2bad3-4567-8901-ae23-456c7c8901be AWS-UpdateWindowsAmi Cancelled 4/16/2019 5:37:04 AM 4/16/2019 5:47:29 AM 61234567-a7f8-90e1-2b34-567b8bf9012c Fixed-UpdateAmi Cancelled 4/16/2019 5:33:04 AM 4/16/2019 5:40:15 AM 91234d56-7e89-0ac1-2aee-34ea5d6a7c89 AWS-UpdateWindowsAmi Failed 4/16/2019 5:22:46 AM 4/16/2019 5:27:29 AM