- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateMaintenanceWindowCommand
Creates 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.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { SSMClient, CreateMaintenanceWindowCommand } from "@aws-sdk/client-ssm"; // ES Modules import
// const { SSMClient, CreateMaintenanceWindowCommand } = require("@aws-sdk/client-ssm"); // CommonJS import
const client = new SSMClient(config);
const input = { // CreateMaintenanceWindowRequest
Name: "STRING_VALUE", // required
Description: "STRING_VALUE",
StartDate: "STRING_VALUE",
EndDate: "STRING_VALUE",
Schedule: "STRING_VALUE", // required
ScheduleTimezone: "STRING_VALUE",
ScheduleOffset: Number("int"),
Duration: Number("int"), // required
Cutoff: Number("int"), // required
AllowUnassociatedTargets: true || false, // required
ClientToken: "STRING_VALUE",
Tags: [ // TagList
{ // Tag
Key: "STRING_VALUE", // required
Value: "STRING_VALUE", // required
},
],
};
const command = new CreateMaintenanceWindowCommand(input);
const response = await client.send(command);
// { // CreateMaintenanceWindowResult
// WindowId: "STRING_VALUE",
// };
CreateMaintenanceWindowCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
AllowUnassociatedTargets Required | boolean | undefined | Enables a maintenance window task to run on managed nodes, even if you haven't registered those nodes as targets. If enabled, then you must specify the unregistered managed nodes (by node 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. |
Cutoff Required | number | undefined | The number of hours before the end of the maintenance window that Amazon Web Services Systems Manager stops scheduling new tasks for execution. |
Duration Required | number | undefined | The duration of the maintenance window in hours. |
Name Required | string | undefined | The name of the maintenance window. |
Schedule Required | string | undefined | The schedule of the maintenance window in the form of a cron or rate expression. |
ClientToken | string | undefined | User-provided idempotency token. |
Description | string | undefined | An optional description for the maintenance window. We recommend specifying a description to help you organize your maintenance windows. |
EndDate | string | undefined | The date and time, in ISO-8601 Extended format, for when you want the maintenance window to become inactive. |
ScheduleOffset | number | undefined | 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. If the schedule offset is |
ScheduleTimezone | string | undefined | The 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. |
StartDate | string | undefined | The date and time, in ISO-8601 Extended format, for when you want the maintenance window to become active. When using a rate schedule, if you provide a start date that occurs in the past, the current date and time are used as the start date. |
Tags | Tag[] | undefined | 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-value pairs:
To add tags to an existing maintenance window, use the AddTagsToResource operation. |
CreateMaintenanceWindowCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
WindowId | string | undefined | The ID of the created maintenance window. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
IdempotentParameterMismatch | client | Error returned when an idempotent operation is retried and the parameters don't match the original call to the API with the same idempotency token. |
InternalServerError | server | An error occurred on the server side. |
ResourceLimitExceededException | client | Error returned when the caller has exceeded the default resource quotas. For example, too many maintenance windows or patch baselines have been created. For information about resource quotas in Systems Manager, see Systems Manager service quotas in the Amazon Web Services General Reference. |
SSMServiceException | Base exception class for all service exceptions from SSM service. |