将 GetMaintenanceWindowExecutionTask 与 CLI 配合使用 - AWS Systems Manager

GetMaintenanceWindowExecutionTask 与 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" }

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

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