All Products
Search
Document Center

Elastic Compute Service:CreatePlanMaintenanceWindow

Last Updated:Jun 15, 2026

Creates an O&M window. When the TargetResource parameter of the O&M window is set to associate with ECS instances and underlying hardware risks are detected that require scheduled O&M to mitigate, the execution time of the scheduled O&M is determined by the time range specified in the TimePeriod parameter. When the execution time of an O&M event is reached, the platform automatically performs the corresponding O&M operation based on the event type.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:CreatePlanMaintenanceWindow

create

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

PlanWindowName

string

Yes

The name of the O&M window. You can specify a custom name. The name can be up to 200 characters in length.

WIndowName

Enable

boolean

Yes

Specifies whether to enable the O&M window.

  • true: Enabled.

  • false: Disabled.

true

SupportMaintenanceAction

string

Yes

The O&M operations supported by the O&M window.

Valid values:

  • Redeploy :

    Redeploy

  • Reboot :

    Reboot

Reboot

RegionId

string

Yes

The region ID. You can call DescribeRegions to query the most recent region list.

cn-hangzhou

TimePeriod

object

Yes

The recurring cycle of the O&M window.

PeriodUnit

string

Yes

The type of the cycle. Valid values: Daily and Weekly.

Valid values:

  • Daily :

    Daily

  • Weekly :

    Weekly

Weekly

RangeList

array<object>

Yes

The time ranges of the recurring cycle of the O&M window (in UTC).

object

No

The time range object.

StartTime

string

No

The start time of the O&M window.

  • If PeriodUnit is set to Weekly, the format is Monday,22:00. Monday can be replaced with Tuesday, Wednesday, Thursday, Friday, Saturday, or Sunday.

  • If PeriodUnit is set to Daily, the format is 22:00.

  • The comma (,) is used as a delimiter. The first part represents the hour, with valid values from 00 to 23. The second part represents the minute, which currently supports only 00.

Monday,22:00

EndTime

string

No

The end time of the O&M window.

  • If PeriodUnit is set to Weekly, the format is Monday,22:00. Monday can be replaced with Tuesday, Wednesday, Thursday, Friday, Saturday, or Sunday.

  • If PeriodUnit is set to Daily, the format is 22:00.

  • The comma (,) is used as a delimiter. The first part represents the hour, with valid values from 00 to 23. The second part represents the minute, which currently supports only 00.

Tuesday,03:00

TargetResource

object

Yes

The resources to which the O&M window applies.

Scope

string

Yes

The resource type for the O&M window.

Valid values:

  • All :

    All

  • Tag :

    Tag

  • ResourceGroup :

    ResourceGroup

Tag

ResourceGroupId

string

No

The ID of the resource group. This parameter is required when Scope is set to ResourceGroup.

rg-aekzhm7pmnvcbty

Tags

array<object>

No

The tags to which the O&M window applies. This parameter is required when Scope is set to Tag.

object

No

The tag value.

Key

string

No

The key of the tag to which the O&M window applies.

vms_qualification_孙总身份证_e5590864-1fef-4db2-b2a7-bd2d657fed43.png

Value

string

No

The value of the tag to which the O&M window applies.

21.137.18.60

MinMaintenanceInterval

integer

No

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

7D5B1188-3F08-56D1-A6B2-91B267452633

PlanWindowId

string

The ID of the created O&M window.

pw-bp1a9yavgq3dgttvowun

Examples

Success response

JSON format

{
  "RequestId": "7D5B1188-3F08-56D1-A6B2-91B267452633",
  "PlanWindowId": "pw-bp1a9yavgq3dgttvowun"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidOperation.TooManyMaintenanceWindows Too many maintenance windows. The number of maintenance window configurations has exceeded 200, and no new windows can be created.
500 InternalError Internal error.
403 AccessForbidden User not authorized to operate on the specified resource. You are not authorized to use the specified resource.
403 MissingParameter.Period The input parameter Period is missing. Missing Period parameter.
403 MissingParameter.TargetType The input parameter TargetType is missing. Missing TargetType parameter.
403 InvalidParameter.TimePeriod Invalid Parameter Time Period. Time Period property error.
403 InvalidParameter.TargetResource Invalid Parameter Target Resource. TargetResource property setting error
403 InvalidParameter.SupportMaintenanceAction Invalid Parameter SupportMaintenanceAction. SupportMaintenanceAction property setting error.
403 InvalidParameter.MinMaintenanceInterval Invalid Parameter MinMaintenanceInterval. MinMaintenanceInterval 参数设置错误

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.