Skip to main content

maintenance_windows

Creates, updates, deletes, gets or lists a maintenance_windows resource.

Overview

Namemaintenance_windows
TypeResource
Idaws.ssm.maintenance_windows

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
allow_unassociated_targetsbooleanWhether targets must be registered with the maintenance window before tasks can be defined for those targets.
created_datestring (date-time)The date the maintenance window was created.
cutoffintegerThe number of hours before the end of the maintenance window that Amazon Web Services Systems Manager stops scheduling new tasks for execution.
descriptionstringThe description of the maintenance window.
durationintegerThe duration of the maintenance window in hours.
enabledbooleanIndicates whether the maintenance window is enabled.
end_datestringThe date and time, in ISO-8601 Extended format, for when the maintenance window is scheduled to become inactive. The maintenance window won't run after this specified time.
modified_datestring (date-time)The date the maintenance window was last modified.
namestringThe name of the maintenance window. (pattern: <code>^[a-zA-Z0-9_-.]{3,128}$</code>)
next_execution_timestringThe next time the maintenance window will actually run, taking into account any specified times for the maintenance window to become active or inactive.
schedulestringThe schedule of the maintenance window in the form of a cron or rate expression.
schedule_offsetintegerThe number of days to wait to run a maintenance window after the scheduled cron expression date and time.
schedule_timezonestringThe time zone that the scheduled maintenance window executions are based on, in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.
start_datestringThe date and time, in ISO-8601 Extended format, for when the maintenance window is scheduled to become active. The maintenance window won't run before this specified time.
window_idstringThe ID of the created maintenance window. (pattern: <code>^mw-[0-9a-f]{17}$</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_maintenance_windowselectregionRetrieves a maintenance window.
describe_maintenance_windowsselectregionRetrieves the maintenance windows in an Amazon Web Services account.
register_target_with_maintenance_windowinsertregion, WindowId, ResourceType, TargetsRegisters a target with a maintenance window.
register_task_with_maintenance_windowinsertregion, WindowId, TaskArn, TaskTypeAdds a new task to a maintenance window.
create_maintenance_windowinsertregion, AllowUnassociatedTargetsCreates a new maintenance window. 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.
update_maintenance_windowupdateregion, WindowIdUpdates an existing maintenance window. Only specified parameters are modified. 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.
deregister_target_from_maintenance_windowdeleteregionRemoves a target from a maintenance window.
deregister_task_from_maintenance_windowdeleteregionRemoves a task from a maintenance window.
delete_maintenance_windowdeleteregionDeletes a maintenance window.
cancel_maintenance_window_executionexecregion, WindowExecutionIdStops a maintenance window execution that is already in progress and cancels any tasks in the window that haven't already starting running. Tasks already in progress will continue to completion.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves a maintenance window.

SELECT
allow_unassociated_targets,
created_date,
cutoff,
description,
duration,
enabled,
end_date,
modified_date,
name,
next_execution_time,
schedule,
schedule_offset,
schedule_timezone,
start_date,
window_id
FROM aws.ssm.maintenance_windows
WHERE region = '{{ region }}' -- required
;

INSERT examples

Registers a target with a maintenance window.

INSERT INTO aws.ssm.maintenance_windows (
WindowId,
ResourceType,
Targets,
OwnerInformation,
Name,
Description,
ClientToken,
region
)
SELECT
'{{ WindowId }}' /* required */,
'{{ ResourceType }}' /* required */,
'{{ Targets }}' /* required */,
'{{ OwnerInformation }}',
'{{ Name }}',
'{{ Description }}',
'{{ ClientToken }}',
'{{ region }}'
RETURNING
window_target_id
;

UPDATE examples

Updates an existing maintenance window. Only specified parameters are modified. 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.

UPDATE aws.ssm.maintenance_windows
SET
WindowId = '{{ WindowId }}',
Name = '{{ Name }}',
Description = '{{ Description }}',
StartDate = '{{ StartDate }}',
EndDate = '{{ EndDate }}',
Schedule = '{{ Schedule }}',
ScheduleTimezone = '{{ ScheduleTimezone }}',
ScheduleOffset = {{ ScheduleOffset }},
Duration = {{ Duration }},
Cutoff = {{ Cutoff }},
AllowUnassociatedTargets = {{ AllowUnassociatedTargets }},
Enabled = {{ Enabled }},
Replace = {{ Replace }}
WHERE
region = '{{ region }}' --required
AND WindowId = '{{ WindowId }}' --required
RETURNING
allow_unassociated_targets,
cutoff,
description,
duration,
enabled,
end_date,
name,
schedule,
schedule_offset,
schedule_timezone,
start_date,
window_id;

DELETE examples

Removes a target from a maintenance window.

DELETE FROM aws.ssm.maintenance_windows
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Stops a maintenance window execution that is already in progress and cancels any tasks in the window that haven't already starting running. Tasks already in progress will continue to completion.

EXEC aws.ssm.maintenance_windows.cancel_maintenance_window_execution
@region='{{ region }}' --required
@@json=
'{
"WindowExecutionId": "{{ WindowExecutionId }}"
}'
;