CmdID

CmdID / aws / aws ssm

aws ssm describe-maintenance-window-tasks

Lists the tasks in a maintenance window. AWS CLI reference

4 examples 4 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To list all tasks for a maintenance window

The following describe-maintenance-window-tasks example lists all of the tasks for the specified maintenance window.

aws ssm describe-maintenance-window-tasks --window-id "mw-06cf17cbefEXAMPLE"Identify
--window-idThe ID of the maintenance window whose tasks should be retrieved.
Its output, shortened
{
    "Tasks": [
        {
            "WindowId": "mw-06cf17cbefEXAMPLE",
            "WindowTaskId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "TaskArn": "AWS-RestartEC2Instance",
            "TaskParameters": {},
            "Type": "AUTOMATION",
            "Description": "Restarting EC2 Instance for maintenance",
            "MaxConcurrency": "1",
            "MaxErrors": "1",
            "Name": "My-Automation-Example-Task",
            "Priority": 0,
            "ServiceRoleArn": "arn:aws:iam::123456789012:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM",
            "Targets": [
                {
                    "Key": "WindowTargetIds",
                    "Values": [
                        "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    ]
                }
            ]
        },
        {
            "WindowId": "mw-06cf17cbefEXAMPLE",
            "WindowTaskId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333",
            "TaskArn": "AWS-DisableS3BucketPublicReadWrite",
            "TaskParameters": {},
            "Type": "AUTOMATION",
            "Description": "Automation task to disable read/write access on public S3 buckets",
… 16 more lines

Example 2: To list all tasks for a maintenance window that invokes the AWS-RunPowerShellScript command document

The following describe-maintenance-window-tasks example lists all of the tasks for the specified maintenance window that invokes the AWS-RunPowerShellScript command document.

aws ssm describe-maintenance-window-tasks --window-id "mw-ab12cd34efEXAMPLE" --filters "Key=TaskArn,Values=AWS-RunPowerShellScript"Identify
--window-idThe ID of the maintenance window whose tasks should be retrieved.
--filtersOptional filters used to narrow down the scope of the returned tasks.
Its output
{
    "Tasks": [
        {
            "WindowId": "mw-ab12cd34efEXAMPLE",
            "WindowTaskId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE44444",
            "TaskArn": "AWS-RunPowerShellScript",
            "Type": "RUN_COMMAND",
            "Targets": [
                {
                    "Key": "WindowTargetIds",
                    "Values": [
                        "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    ]
                }
            ],
            "TaskParameters": {},
            "Priority": 1,
            "ServiceRoleArn": "arn:aws:iam::123456789012:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM",
            "MaxConcurrency": "1",
            "MaxErrors": "1",
            "Name": "MyTask"
        }
    ]
}

Example 3: To list all tasks for a maintenance window that have a Priority of 3

The following describe-maintenance-window-tasks example lists all of the tasks for the specified maintenance window that have a Priority of 3.

aws ssm describe-maintenance-window-tasks --window-id "mw-ab12cd34efEXAMPLE" --filters "Key=Priority,Values=3"Identify
--window-idThe ID of the maintenance window whose tasks should be retrieved.
--filtersOptional filters used to narrow down the scope of the returned tasks.
Its output, shortened
{
    "Tasks": [
        {
            "WindowId": "mw-ab12cd34efEXAMPLE",
            "WindowTaskId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE44444",
            "TaskArn": "AWS-RunPowerShellScript",
            "Type": "RUN_COMMAND",
            "Targets": [
                {
                    "Key": "WindowTargetIds",
                    "Values": [
                        "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    ]
                }
            ],
            "TaskParameters": {},
            "Priority": 3,
            "ServiceRoleArn": "arn:aws:iam::123456789012:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM",
            "MaxConcurrency": "1",
            "MaxErrors": "1",
            "Name": "MyRunCommandTask"
        },
        {
            "WindowId": "mw-ab12cd34efEXAMPLE",
            "WindowTaskId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE55555",
            "TaskArn": "AWS-RestartEC2Instance",
            "Type": "AUTOMATION",
            "Targets": [
                {
                    "Key": "WindowTargetIds",
… 15 more lines

Example 4: To list all tasks for a maintenance window that have a Priority of 1 and use Run Command

The following describe-maintenance-window-tasks example lists all of the tasks for the specified maintenance window that have a Priority of 1 and use Run Command.

aws ssm describe-maintenance-window-tasks --window-id "mw-ab12cd34efEXAMPLE" --filters "Key=Priority,Values=1" "Key=TaskType,Values=RUN_COMMAND"Identify
--window-idThe ID of the maintenance window whose tasks should be retrieved.
--filtersOptional filters used to narrow down the scope of the returned tasks.
Its output
{
    "Tasks": [
        {
            "WindowId": "mw-ab12cd34efEXAMPLE",
            "WindowTaskId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE44444",
            "TaskArn": "AWS-RunPowerShellScript",
            "Type": "RUN_COMMAND",
            "Targets": [
                {
                    "Key": "WindowTargetIds",
                    "Values": [
                        "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    ]
                }
            ],
            "TaskParameters": {},
            "Priority": 1,
            "ServiceRoleArn": "arn:aws:iam::123456789012:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM",
            "MaxConcurrency": "1",
            "MaxErrors": "1",
            "Name": "MyRunCommandTask"
        }
    ]
}

For more information, see View information about maintenance windows (AWS CLI) in the AWS Systems Manager User Guide.

Options

4 in the AWS CLI reference
--filtersOptional filters used to narrow down the scope of the returned tasks.
--max-resultsThe maximum number of items to return for this call.
--next-tokenThe token for the next set of items to return.
--window-idThe ID of the maintenance window whose tasks should be retrieved.