Use GetAutomationExecution with an Amazon SDK or CLI - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use GetAutomationExecution with an Amazon SDK or CLI

The following code examples show how to use GetAutomationExecution.

CLI
Amazon CLI

To display details about an automation execution

The following get-automation-execution example displays detailed information about an Automation execution.

aws ssm get-automation-execution \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE

Output:

{ "AutomationExecution": { "AutomationExecutionId": "73c8eef8-f4ee-4a05-820c-e354fEXAMPLE", "DocumentName": "AWS-StartEC2Instance", "DocumentVersion": "1", "ExecutionStartTime": 1583737233.748, "ExecutionEndTime": 1583737234.719, "AutomationExecutionStatus": "Success", "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": {} } ], "StepExecutionsTruncated": false, "Parameters": { "AutomationAssumeRole": [ "" ], "InstanceId": [ "i-0cb99161f6EXAMPLE" ] }, "Outputs": {}, "Mode": "Auto", "ExecutedBy": "arn:aws:sts::29884EXAMPLE:assumed-role/mw_service_role/OrchestrationService", "Targets": [], "ResolvedTargets": { "ParameterValues": [], "Truncated": false } } }

For more information, see Walkthrough: Patch a Linux AMI (Amazon CLI) in the Amazon Systems Manager User Guide.

PowerShell
Tools for PowerShell

Example 1: This example displays the details of an Automation Execution.

Get-SSMAutomationExecution -AutomationExecutionId "4105a4fc-f944-11e6-9d32-8fb2db27a909"

Output:

AutomationExecutionId : 4105a4fc-f944-11e6-9d32-8fb2db27a909 AutomationExecutionStatus : Failed DocumentName : AWS-UpdateLinuxAmi DocumentVersion : 1 ExecutionEndTime : 2/22/2017 9:17:08 PM ExecutionStartTime : 2/22/2017 9:17:02 PM FailureMessage : Step launchInstance failed maximum allowed times. You are not authorized to perform this operation. Encoded authorization failure message: B_V2QyyN7NhSZQYpmVzpEc4oSnj2GLTNYnXUHsTbqJkNMoDgubmbtthLmZyaiUYekORIrA42-fv1x-04q5Fjff6glh Yb6TI5b0GQeeNrpwNvpDzmO-PSR1swlAbg9fdM9BcNjyrznspUkWpuKu9EC1Ou6v3OXU1KC9nZ7mPlWMFZNkSioQqpwWEvMw-GZktsQzm67qOhUhBNOLWYhbS pkfiqzY-5nw3S0obx30fhd3EJa5O_-GjV_a0nFXQJa70ik40bFOrEh3MtCSbrQT6--DvFy_FQ8TKvkIXadyVskeJI84XOF5WmA60f1pi5GI08i-nRfZS6oDeU gELBjjoFKD8s3L2aI0B6umWVxnQOjqhQRxwJ53b54sZJ2PW3v_mtg9-q0CK0ezS3xfh_y0ilaUGOAZG-xjQFuvU_JZedWpla3xi-MZsmblAifBI (Service: AmazonEC2; Status Code: 403; Error Code: UnauthorizedOperation; Request ID: 6a002f94-ba37-43fd-99e6-39517715fce5) Outputs : {[createImage.ImageId, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]]} Parameters : {[AutomationAssumeRole, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]], [InstanceIamRole, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]], [SourceAmiId, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]]} StepExecutions : {launchInstance, updateOSSoftware, stopInstance, createImage...}

Example 2: This example lists step details for the given automation execution id

Get-SSMAutomationExecution -AutomationExecutionId e1d2bad3-4567-8901-ae23-456c7c8901be | Select-Object -ExpandProperty StepExecutions | Select-Object StepName, Action, StepStatus, ValidNextSteps

Output:

StepName Action StepStatus ValidNextSteps -------- ------ ---------- -------------- LaunchInstance aws:runInstances Success {OSCompatibilityCheck} OSCompatibilityCheck aws:runCommand Success {RunPreUpdateScript} RunPreUpdateScript aws:runCommand Success {UpdateEC2Config} 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 {}

For a complete list of Amazon SDK developer guides and code examples, see Using Systems Manager with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.