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

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

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

GetMaintenanceWindowExecutionTask与 a 一起使用 CLI

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

CLI
AWS CLI

获取有关维护时段任务执行的信息

以下 get-maintenance-window-execution-task 示例列出有关作为指定维护时段执行组成部分的任务的信息。

aws ssm get-maintenance-window-execution-task \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2EXAMPLE" \ --task-id "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE"

输出:

{ "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2EXAMPLE", "TaskExecutionId": "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE", "TaskArn": "AWS-RunPatchBaseline", "ServiceRole": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "Type": "RUN_COMMAND", "TaskParameters": [ { "BaselineOverride": { "Values": [ "" ] }, "InstallOverrideList": { "Values": [ "" ] }, "Operation": { "Values": [ "Scan" ] }, "RebootOption": { "Values": [ "RebootIfNeeded" ] }, "SnapshotId": { "Values": [ "{{ aws:ORCHESTRATION_ID }}" ] }, "aws:InstanceId": { "Values": [ "i-02573cafcfEXAMPLE", "i-0471e04240EXAMPLE", "i-07782c72faEXAMPLE" ] } } ], "Priority": 1, "MaxConcurrency": "1", "MaxErrors": "3", "Status": "SUCCESS", "StartTime": "2021-08-04T11:45:35.088000-07:00", "EndTime": "2021-08-04T11:53:09.079000-07:00" }

有关更多信息,请参阅《S AWS ystems Manager 用户指南》中的 “查看有关任务和任务执行的信息 (AWS CLI)”。

PowerShell
用于 PowerShell

示例 1:此示例列出有关维护时段执行组成部分的任务的信息。

Get-SSMMaintenanceWindowExecutionTask -TaskId "ac0c6ae1-daa3-4a89-832e-d384503b6586" -WindowExecutionId "518d5565-5969-4cca-8f0e-da3b2a638355"

输出:

EndTime : 2/21/2017 4:00:35 PM MaxConcurrency : 1 MaxErrors : 1 Priority : 10 ServiceRole : arn:aws:iam::123456789012:role/MaintenanceWindowsRole StartTime : 2/21/2017 4:00:34 PM Status : FAILED StatusDetails : The maximum error count was exceeded. TaskArn : AWS-RunShellScript TaskExecutionId : ac0c6ae1-daa3-4a89-832e-d384503b6586 TaskParameters : {Amazon.Runtime.Internal.Util.AlwaysSendDictionary`2[System.String,Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskPara meterValueExpression]} Type : RUN_COMMAND WindowExecutionId : 518d5565-5969-4cca-8f0e-da3b2a638355