Amazon Simple Systems Manager (SSM)

2018/10/09 - Amazon Simple Systems Manager (SSM) - 3 new 4 updated api methods

Changes  Adds StartDate, EndDate, and ScheduleTimezone to CreateMaintenanceWindow and UpdateMaintenanceWindow; Adds NextExecutionTime to GetMaintenanceWindow and DescribeMaintenanceWindows; Adds CancelMaintenanceWindowExecution, DescribeMaintenanceWindowSchedule and DescribeMaintenanceWindowsForTarget APIs.

DescribeMaintenanceWindowSchedule (new) Link ¶

Retrieves information about upcoming executions of a Maintenance Window.

See also: AWS API Documentation

Request Syntax

client.describe_maintenance_window_schedule(
    WindowId='string',
    Targets=[
        {
            'Key': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    ResourceType='INSTANCE',
    Filters=[
        {
            'Key': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    NextToken='string'
)
type WindowId

string

param WindowId

The ID of the Maintenance Window to retrieve information about.

type Targets

list

param Targets

The instance ID or key/value pair to retrieve information about.

  • (dict) --

    An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call.

    • Key (string) --

      User-defined criteria for sending commands that target instances that meet the criteria. Key can be tag:<Amazon EC2 tag> or InstanceIds. For more information about how to send commands that target instances using Key,Value parameters, see Targeting Multiple Instances in the AWS Systems Manager User Guide .

    • Values (list) --

      User-defined criteria that maps to Key. For example, if you specified tag:ServerRole, you could specify value:WebServer to execute a command on instances that include Amazon EC2 tags of ServerRole,WebServer. For more information about how to send commands that target instances using Key,Value parameters, see Sending Commands to a Fleet in the AWS Systems Manager User Guide .

      • (string) --

type ResourceType

string

param ResourceType

The type of resource you want to retrieve information about. For example, "INSTANCE".

type Filters

list

param Filters

Filters used to limit the range of results. For example, you can limit Maintenance Window executions to only those scheduled before or after a certain date and time.

  • (dict) --

    Defines a filter used in Patch Manager APIs.

    • Key (string) --

      The key for the filter.

    • Values (list) --

      The value for the filter.

      • (string) --

type MaxResults

integer

param MaxResults

The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

type NextToken

string

param NextToken

The token for the next set of items to return. (You received this token from a previous call.)

rtype

dict

returns

Response Syntax

{
    'ScheduledWindowExecutions': [
        {
            'WindowId': 'string',
            'Name': 'string',
            'ExecutionTime': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ScheduledWindowExecutions (list) --

      Information about Maintenance Window executions scheduled for the specified time range.

      • (dict) --

        Information about a scheduled execution for a Maintenance Window.

        • WindowId (string) --

          The ID of the Maintenance Window to be run.

        • Name (string) --

          The name of the Maintenance Window to be run.

        • ExecutionTime (string) --

          The time, in ISO-8601 Extended format, that the Maintenance Window is scheduled to be run.

    • NextToken (string) --

      The token for the next set of items to return. (You use this token in the next call.)

DescribeMaintenanceWindowsForTarget (new) Link ¶

Retrieves information about the Maintenance Windows targets or tasks that an instance is associated with.

See also: AWS API Documentation

Request Syntax

client.describe_maintenance_windows_for_target(
    Targets=[
        {
            'Key': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    ResourceType='INSTANCE',
    MaxResults=123,
    NextToken='string'
)
type Targets

list

param Targets

[REQUIRED]

The instance ID or key/value pair to retrieve information about.

  • (dict) --

    An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call.

    • Key (string) --

      User-defined criteria for sending commands that target instances that meet the criteria. Key can be tag:<Amazon EC2 tag> or InstanceIds. For more information about how to send commands that target instances using Key,Value parameters, see Targeting Multiple Instances in the AWS Systems Manager User Guide .

    • Values (list) --

      User-defined criteria that maps to Key. For example, if you specified tag:ServerRole, you could specify value:WebServer to execute a command on instances that include Amazon EC2 tags of ServerRole,WebServer. For more information about how to send commands that target instances using Key,Value parameters, see Sending Commands to a Fleet in the AWS Systems Manager User Guide .

      • (string) --

type ResourceType

string

param ResourceType

[REQUIRED]

The type of resource you want to retrieve information about. For example, "INSTANCE".

type MaxResults

integer

param MaxResults

The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

type NextToken

string

param NextToken

The token for the next set of items to return. (You received this token from a previous call.)

rtype

dict

returns

Response Syntax

{
    'WindowIdentities': [
        {
            'WindowId': 'string',
            'Name': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • WindowIdentities (list) --

      Information about the Maintenance Window targets and tasks an instance is associated with.

      • (dict) --

        The Maintenance Window to which the specified target belongs.

        • WindowId (string) --

          The ID of the Maintenance Window.

        • Name (string) --

          The name of the Maintenance Window.

    • NextToken (string) --

      The token for the next set of items to return. (You use this token in the next call.)

CancelMaintenanceWindowExecution (new) Link ¶

Stops a Maintenance Window execution that is already in progress and cancels any tasks in the window that have not already starting running. (Tasks already in progress will continue to completion.)

See also: AWS API Documentation

Request Syntax

client.cancel_maintenance_window_execution(
    WindowExecutionId='string'
)
type WindowExecutionId

string

param WindowExecutionId

[REQUIRED]

The ID of the Maintenance Window execution to stop.

rtype

dict

returns

Response Syntax

{
    'WindowExecutionId': 'string'
}

Response Structure

  • (dict) --

    • WindowExecutionId (string) --

      The ID of the Maintenance Window execution that has been stopped.

CreateMaintenanceWindow (updated) Link ¶
Changes (request)
{'EndDate': 'string', 'ScheduleTimezone': 'string', 'StartDate': 'string'}

Creates a new Maintenance Window.

See also: AWS API Documentation

Request Syntax

client.create_maintenance_window(
    Name='string',
    Description='string',
    StartDate='string',
    EndDate='string',
    Schedule='string',
    ScheduleTimezone='string',
    Duration=123,
    Cutoff=123,
    AllowUnassociatedTargets=True|False,
    ClientToken='string'
)
type Name

string

param Name

[REQUIRED]

The name of the Maintenance Window.

type Description

string

param Description

An optional description for the Maintenance Window. We recommend specifying a description to help you organize your Maintenance Windows.

type StartDate

string

param StartDate

The date and time, in ISO-8601 Extended format, for when you want the Maintenance Window to become active. StartDate allows you to delay activation of the Maintenance Window until the specified future date.

type EndDate

string

param EndDate

The date and time, in ISO-8601 Extended format, for when you want the Maintenance Window to become inactive. EndDate allows you to set a date and time in the future when the Maintenance Window will no longer run.

type Schedule

string

param Schedule

[REQUIRED]

The schedule of the Maintenance Window in the form of a cron or rate expression.

type ScheduleTimezone

string

param ScheduleTimezone

The time zone that the scheduled Maintenance Window executions are based on, in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.

type Duration

integer

param Duration

[REQUIRED]

The duration of the Maintenance Window in hours.

type Cutoff

integer

param Cutoff

[REQUIRED]

The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.

type AllowUnassociatedTargets

boolean

param AllowUnassociatedTargets

[REQUIRED]

Enables a Maintenance Window task to execute on managed instances, even if you have not registered those instances as targets. If enabled, then you must specify the unregistered instances (by instance ID) when you register a task with the Maintenance Window

If you don't enable this option, then you must specify previously-registered targets when you register a task with the Maintenance Window.

type ClientToken

string

param ClientToken

User-provided idempotency token.

This field is autopopulated if not provided.

rtype

dict

returns

Response Syntax

{
    'WindowId': 'string'
}

Response Structure

  • (dict) --

    • WindowId (string) --

      The ID of the created Maintenance Window.

DescribeMaintenanceWindows (updated) Link ¶
Changes (response)
{'WindowIdentities': {'EndDate': 'string',
                      'NextExecutionTime': 'string',
                      'Schedule': 'string',
                      'ScheduleTimezone': 'string',
                      'StartDate': 'string'}}

Retrieves the Maintenance Windows in an AWS account.

See also: AWS API Documentation

Request Syntax

client.describe_maintenance_windows(
    Filters=[
        {
            'Key': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    NextToken='string'
)
type Filters

list

param Filters

Optional filters used to narrow down the scope of the returned Maintenance Windows. Supported filter keys are Name and Enabled.

  • (dict) --

    Filter used in the request. Supported filter keys are Name and Enabled.

    • Key (string) --

      The name of the filter.

    • Values (list) --

      The filter values.

      • (string) --

type MaxResults

integer

param MaxResults

The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

type NextToken

string

param NextToken

The token for the next set of items to return. (You received this token from a previous call.)

rtype

dict

returns

Response Syntax

{
    'WindowIdentities': [
        {
            'WindowId': 'string',
            'Name': 'string',
            'Description': 'string',
            'Enabled': True|False,
            'Duration': 123,
            'Cutoff': 123,
            'Schedule': 'string',
            'ScheduleTimezone': 'string',
            'EndDate': 'string',
            'StartDate': 'string',
            'NextExecutionTime': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • WindowIdentities (list) --

      Information about the Maintenance Windows.

      • (dict) --

        Information about the Maintenance Window.

        • WindowId (string) --

          The ID of the Maintenance Window.

        • Name (string) --

          The name of the Maintenance Window.

        • Description (string) --

          A description of the Maintenance Window.

        • Enabled (boolean) --

          Whether the Maintenance Window is enabled.

        • Duration (integer) --

          The duration of the Maintenance Window in hours.

        • Cutoff (integer) --

          The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.

        • Schedule (string) --

          The schedule of the Maintenance Window in the form of a cron or rate expression.

        • ScheduleTimezone (string) --

          The time zone that the scheduled Maintenance Window executions are based on, in Internet Assigned Numbers Authority (IANA) format.

        • EndDate (string) --

          The date and time, in ISO-8601 Extended format, for when the Maintenance Window is scheduled to become inactive.

        • StartDate (string) --

          The date and time, in ISO-8601 Extended format, for when the Maintenance Window is scheduled to become active.

        • NextExecutionTime (string) --

          The next time the Maintenance Window will actually run, taking into account any specified times for the Maintenance Window to become active or inactive.

    • NextToken (string) --

      The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.

GetMaintenanceWindow (updated) Link ¶
Changes (response)
{'EndDate': 'string',
 'NextExecutionTime': 'string',
 'ScheduleTimezone': 'string',
 'StartDate': 'string'}

Retrieves a Maintenance Window.

See also: AWS API Documentation

Request Syntax

client.get_maintenance_window(
    WindowId='string'
)
type WindowId

string

param WindowId

[REQUIRED]

The ID of the desired Maintenance Window.

rtype

dict

returns

Response Syntax

{
    'WindowId': 'string',
    'Name': 'string',
    'Description': 'string',
    'StartDate': 'string',
    'EndDate': 'string',
    'Schedule': 'string',
    'ScheduleTimezone': 'string',
    'NextExecutionTime': 'string',
    'Duration': 123,
    'Cutoff': 123,
    'AllowUnassociatedTargets': True|False,
    'Enabled': True|False,
    'CreatedDate': datetime(2015, 1, 1),
    'ModifiedDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • WindowId (string) --

      The ID of the created Maintenance Window.

    • Name (string) --

      The name of the Maintenance Window.

    • Description (string) --

      The description of the Maintenance Window.

    • StartDate (string) --

      The date and time, in ISO-8601 Extended format, for when the Maintenance Window is scheduled to become active. The Maintenance Window will not run before this specified time.

    • EndDate (string) --

      The date and time, in ISO-8601 Extended format, for when the Maintenance Window is scheduled to become inactive. The Maintenance Window will not run after this specified time.

    • Schedule (string) --

      The schedule of the Maintenance Window in the form of a cron or rate expression.

    • ScheduleTimezone (string) --

      The time zone that the scheduled Maintenance Window executions are based on, in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.

    • NextExecutionTime (string) --

      The next time the Maintenance Window will actually run, taking into account any specified times for the Maintenance Window to become active or inactive.

    • Duration (integer) --

      The duration of the Maintenance Window in hours.

    • Cutoff (integer) --

      The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.

    • AllowUnassociatedTargets (boolean) --

      Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.

    • Enabled (boolean) --

      Whether the Maintenance Windows is enabled.

    • CreatedDate (datetime) --

      The date the Maintenance Window was created.

    • ModifiedDate (datetime) --

      The date the Maintenance Window was last modified.

UpdateMaintenanceWindow (updated) Link ¶
Changes (both)
{'EndDate': 'string', 'ScheduleTimezone': 'string', 'StartDate': 'string'}

Updates an existing Maintenance Window. Only specified parameters are modified.

See also: AWS API Documentation

Request Syntax

client.update_maintenance_window(
    WindowId='string',
    Name='string',
    Description='string',
    StartDate='string',
    EndDate='string',
    Schedule='string',
    ScheduleTimezone='string',
    Duration=123,
    Cutoff=123,
    AllowUnassociatedTargets=True|False,
    Enabled=True|False,
    Replace=True|False
)
type WindowId

string

param WindowId

[REQUIRED]

The ID of the Maintenance Window to update.

type Name

string

param Name

The name of the Maintenance Window.

type Description

string

param Description

An optional description for the update request.

type StartDate

string

param StartDate

The time zone that the scheduled Maintenance Window executions are based on, in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.

type EndDate

string

param EndDate

The date and time, in ISO-8601 Extended format, for when you want the Maintenance Window to become inactive. EndDate allows you to set a date and time in the future when the Maintenance Window will no longer run.

type Schedule

string

param Schedule

The schedule of the Maintenance Window in the form of a cron or rate expression.

type ScheduleTimezone

string

param ScheduleTimezone

The time zone that the scheduled Maintenance Window executions are based on, in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.

type Duration

integer

param Duration

The duration of the Maintenance Window in hours.

type Cutoff

integer

param Cutoff

The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.

type AllowUnassociatedTargets

boolean

param AllowUnassociatedTargets

Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.

type Enabled

boolean

param Enabled

Whether the Maintenance Window is enabled.

type Replace

boolean

param Replace

If True, then all fields that are required by the CreateMaintenanceWindow action are also required for this API request. Optional fields that are not specified are set to null.

rtype

dict

returns

Response Syntax

{
    'WindowId': 'string',
    'Name': 'string',
    'Description': 'string',
    'StartDate': 'string',
    'EndDate': 'string',
    'Schedule': 'string',
    'ScheduleTimezone': 'string',
    'Duration': 123,
    'Cutoff': 123,
    'AllowUnassociatedTargets': True|False,
    'Enabled': True|False
}

Response Structure

  • (dict) --

    • WindowId (string) --

      The ID of the created Maintenance Window.

    • Name (string) --

      The name of the Maintenance Window.

    • Description (string) --

      An optional description of the update.

    • StartDate (string) --

      The date and time, in ISO-8601 Extended format, for when the Maintenance Window is scheduled to become active. The Maintenance Window will not run before this specified time.

    • EndDate (string) --

      The date and time, in ISO-8601 Extended format, for when the Maintenance Window is scheduled to become inactive. The Maintenance Window will not run after this specified time.

    • Schedule (string) --

      The schedule of the Maintenance Window in the form of a cron or rate expression.

    • ScheduleTimezone (string) --

      The time zone that the scheduled Maintenance Window executions are based on, in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "etc/UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.

    • Duration (integer) --

      The duration of the Maintenance Window in hours.

    • Cutoff (integer) --

      The number of hours before the end of the Maintenance Window that Systems Manager stops scheduling new tasks for execution.

    • AllowUnassociatedTargets (boolean) --

      Whether targets must be registered with the Maintenance Window before tasks can be defined for those targets.

    • Enabled (boolean) --

      Whether the Maintenance Window is enabled.