Amazon Simple Systems Manager (SSM)

2020/06/18 - Amazon Simple Systems Manager (SSM) - 4 updated api methods

Changes  Added offset support for specifying the number of days to wait after the date and time specified by a CRON expression before running the maintenance window.

CreateMaintenanceWindow (updated) Link ¶
Changes (request)
{'ScheduleOffset': 'integer'}

Creates a new maintenance window.

Note

The value you specify for Duration determines the specific end time for the maintenance window based on the time it begins. No maintenance window tasks are permitted to start after the resulting endtime minus the number of hours you specify for Cutoff . For example, if the maintenance window starts at 3 PM, the duration is three hours, and the value you specify for Cutoff is one hour, no maintenance window tasks can start after 5 PM.

See also: AWS API Documentation

Request Syntax

client.create_maintenance_window(
    Name='string',
    Description='string',
    StartDate='string',
    EndDate='string',
    Schedule='string',
    ScheduleTimezone='string',
    ScheduleOffset=123,
    Duration=123,
    Cutoff=123,
    AllowUnassociatedTargets=True|False,
    ClientToken='string',
    Tags=[
        {
            'Key': 'string',
            'Value': '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 ScheduleOffset

integer

param ScheduleOffset

The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.

For example, the following cron expression schedules a maintenance window to run on the third Tuesday of every month at 11:30 PM.

cron(0 30 23 ? * TUE#3 *)

If the schedule offset is 2 , the maintenance window won't run until two days later.

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

type Tags

list

param Tags

Optional metadata that you assign to a resource. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a maintenance window to identify the type of tasks it will run, the types of targets, and the environment it will run in. In this case, you could specify the following key name/value pairs:

  • Key=TaskType,Value=AgentUpdate

  • Key=OS,Value=Windows

  • Key=Environment,Value=Production

Note

To add tags to an existing maintenance window, use the AddTagsToResource action.

  • (dict) --

    Metadata that you assign to your AWS resources. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment. In Systems Manager, you can apply tags to documents, managed instances, maintenance windows, Parameter Store parameters, and patch baselines.

    • Key (string) -- [REQUIRED]

      The name of the tag.

    • Value (string) -- [REQUIRED]

      The value of the tag.

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': {'ScheduleOffset': 'integer'}}

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',
            'ScheduleOffset': 123,
            '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) --

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

        • ScheduleOffset (integer) --

          The number of days to wait to run a maintenance window after the scheduled CRON expression date and time.

        • 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)
{'ScheduleOffset': 'integer'}

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 maintenance window for which you want to retrieve information.

rtype

dict

returns

Response Syntax

{
    'WindowId': 'string',
    'Name': 'string',
    'Description': 'string',
    'StartDate': 'string',
    'EndDate': 'string',
    'Schedule': 'string',
    'ScheduleTimezone': 'string',
    'ScheduleOffset': 123,
    '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.

    • ScheduleOffset (integer) --

      The number of days to wait to run a maintenance window after the scheduled CRON expression date and time.

    • 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) --

      Indicates whether the maintenance window 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)
{'ScheduleOffset': 'integer'}

Updates an existing maintenance window. Only specified parameters are modified.

Note

The value you specify for Duration determines the specific end time for the maintenance window based on the time it begins. No maintenance window tasks are permitted to start after the resulting endtime minus the number of hours you specify for Cutoff . For example, if the maintenance window starts at 3 PM, the duration is three hours, and the value you specify for Cutoff is one hour, no maintenance window tasks can start after 5 PM.

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',
    ScheduleOffset=123,
    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 ScheduleOffset

integer

param ScheduleOffset

The number of days to wait after the date and time specified by a CRON expression before running the maintenance window.

For example, the following cron expression schedules a maintenance window to run the third Tuesday of every month at 11:30 PM.

cron(0 30 23 ? * TUE#3 *)

If the schedule offset is 2 , the maintenance window won't run until two days later.

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',
    'ScheduleOffset': 123,
    '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.

    • ScheduleOffset (integer) --

      The number of days to wait to run a maintenance window after the scheduled CRON expression date and time.

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