将 DescribeAutomationStepExecutions 与 Amazon SDK 或 CLI 配合使用 - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

DescribeAutomationStepExecutions 与 Amazon SDK 或 CLI 配合使用

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

CLI
Amazon 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

有关更多信息,请参阅《Amazon 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

有关 Amazon SDK 开发人员指南和代码示例的完整列表,请参阅 将 Systems Manager 与 Amazon SDK 配合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。