与 AWS SDK或DescribeAutomationStepExecutions一起使用 CLI - AWS SDK代码示例

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

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

与 AWS SDK或DescribeAutomationStepExecutions一起使用 CLI

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

CLI
AWS CLI

示例 1:描述自动化执行的所有步骤

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

aws ssm describe-automation-step-executions \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE

输出:

{ "StepExecutions": [ { "StepName": "startInstances", "Action": "aws:changeInstanceState", "ExecutionStartTime": 1583737234.134, "ExecutionEndTime": 1583737234.672, "StepStatus": "Success", "Inputs": { "DesiredState": "\"running\"", "InstanceIds": "[\"i-0cb99161f6EXAMPLE\"]" }, "Outputs": { "InstanceStates": [ "running" ] }, "StepExecutionId": "95e70479-cf20-4d80-8018-7e4e2EXAMPLE", "OverriddenParameters": {} } ] }

示例 2:描述自动化执行的特定步骤

以下 describe-automation-step-executions 示例显示了有关自动化执行中特定步骤的详细信息。

aws ssm describe-automation-step-executions \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE \ --filters Key=StepExecutionId,Values=95e70479-cf20-4d80-8018-7e4e2EXAMPLE

有关更多信息,请参阅《AWS Systems Manager 用户指南》中的分步运行自动化工作流程(命令行)

PowerShell
用于 PowerShell

示例 1:此示例显示有关自动化工作流程中所有活动和已终止步骤执行的信息。

Get-SSMAutomationStepExecution -AutomationExecutionId e1d2bad3-4567-8901-ae23-456c7c8901be | Select-Object StepName, Action, StepStatus

输出:

StepName Action StepStatus -------- ------ ---------- LaunchInstance aws:runInstances Success OSCompatibilityCheck aws:runCommand Success RunPreUpdateScript aws:runCommand Success UpdateEC2Config aws:runCommand Cancelled UpdateSSMAgent aws:runCommand Pending UpdateAWSPVDriver aws:runCommand Pending UpdateAWSEnaNetworkDriver aws:runCommand Pending UpdateAWSNVMe aws:runCommand Pending InstallWindowsUpdates aws:runCommand Pending RunPostUpdateScript aws:runCommand Pending RunSysprepGeneralize aws:runCommand Pending StopInstance aws:changeInstanceState Pending CreateImage aws:createImage Pending TerminateInstance aws:changeInstanceState Pending