Gunakan GetAutomationExecution dengan AWS SDK atau CLI - AWS Systems Manager

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan GetAutomationExecution dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanGetAutomationExecution.

CLI
AWS CLI

Untuk menampilkan detail tentang eksekusi otomatisasi

get-automation-executionContoh berikut menampilkan informasi rinci tentang eksekusi Otomasi.

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 } } }

Untuk informasi selengkapnya, lihat Walkthrough: Patch a Linux AMI (AWS CLI) di Panduan Pengguna AWS Systems Manager.

PowerShell
Alat untuk PowerShell

Contoh 1: Contoh ini menampilkan detail Eksekusi Otomasi.

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...}

Contoh 2: Contoh ini mencantumkan detail langkah untuk id eksekusi otomatisasi yang diberikan

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 {}

Untuk daftar lengkap panduan AWS SDK pengembang dan contoh kode, lihatMenggunakan Systems Manager dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang SDK versi sebelumnya.