All Products
Search
Document Center

Elastic Compute Service:ModifyAutoSnapshotPolicyEx

Last Updated:Sep 28, 2026

Modifies an automatic snapshot policy, such as the snapshot creation time, repeat date, and retention period.

Operation description

When you call this operation, take note of the following items:

  • System policies cannot be modified.

  • After you modify an automatic snapshot policy, the disks to which the policy has been applied immediately execute the modified automatic snapshot policy.

  • If cross-region snapshot replication is enabled and no encryption parameters are configured, encrypted snapshots are encrypted by using the service key of the destination region by default.

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:ModifyAutoSnapshotPolicyEx

update

*Snapshot

acs:ecs:{#regionId}:{#accountId}:snapshotpolicy/{#autoSnapshotPolicyId}

None None

Request parameters

Parameter

Type

Required

Description

Example

regionId

string

Yes

The region ID of the automatic snapshot policy. You can call DescribeRegions to query the most recent region list.

cn-hangzhou

autoSnapshotPolicyId

string

Yes

The ID of the automatic snapshot policy. You can call DescribeAutoSnapshotPolicyEx to query available automatic snapshot policies.

sp-bp12m37ccmxvbmi5****

autoSnapshotPolicyName

string

No

The name of the automatic snapshot policy. If this parameter is left empty, the name is not modified.

SPTestName

timePoints

string

No

The points in time at which automatic snapshots are created. The time is displayed in UTC+8. Unit: hours. Valid values: 0 to 23, which correspond to the 24 points in time from 00:00 to 23:00. For example, 1 indicates 01:00.

To create multiple automatic snapshots within a day, specify multiple points in time:

  • You can specify up to 24 points in time.

  • Specify multiple points in time in a JSON array, such as "0", "1", … "23". Separate the points in time with commas (,).

["0", "1"]

repeatWeekdays

string

No

The days of the week on which automatic snapshots are created. Unit: days. The cycle is weekly. Valid values: 1 to 7. For example, 1 indicates Monday.

To create multiple automatic snapshots within a week, specify multiple days:

  • You can specify up to 7 days.

  • Specify multiple days in a JSON array, such as "1", "2", … "7". Separate the days with commas (,).

["1", "7"]

retentionDays

integer

No

The retention period of automatic snapshots. Unit: days. Valid values:

  • -1: Automatic snapshots are permanently retained.

  • 1 to 65536: Automatic snapshots are retained for the specified number of days.

Default value: -1.

30

EnableCrossRegionCopy

boolean

No

Specifies whether to allow automatic cross-region replication.

  • true: Allowed.

  • false: Not allowed.

false

TargetCopyRegions

string

No

The destination region to which snapshots are replicated across regions. Currently, you can set only one destination region.

["cn-hangzhou"]

CopiedSnapshotsRetentionDays

integer

No

The retention period of cross-region snapshot replicas. Unit: days. Valid values:

  • -1: Snapshot replicas are permanently retained.

  • 1 to 65535: Snapshot replicas are retained for the specified number of days.

Default value: -1.

30

CopyEncryptionConfiguration

object

No

The encryption parameter object for cross-region snapshot replication.

Arn

array<object>

No

This parameter is not publicly available.

object

No

AssumeRoleFor

integer

No

This parameter is not publicly available.

1000000000

RoleType

string

No

This parameter is not publicly available.

hide

Rolearn

string

No

This parameter is not publicly available.

hide

Encrypted

boolean

No

Specifies whether to enable encryption for cross-region snapshot replication. Valid values:

  • true: Enabled.

  • false: Disabled.

Default value: false.

false

KMSKeyId

string

No

The key ID of the KMS key used for encrypted cross-region snapshot replication.

0e478b7a-4262-4802-b8cb-00d3fb40826X

TargetTags

array<object>

No

The list of target resource tags. The automatic snapshot policy matches target resources based on tags.

object

No

The target resource tag.

Key

string

No

The tag key.

Valid values of N: 1 to 5.

The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot start with aliyun or acs:. The tag key cannot contain http:// or https://.

Value

string

No

The tag value.

Valid values of N: 1 to 5.

The tag value can be up to 128 characters in length and cannot contain http:// or https://.

Note

If you pass in an empty value or an empty string, the tag value matches any value.

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.EncryptedIllegal The Encrypted parameter must be set to true when KMSKeyId is specified. Please adjust the parameters and try again.
400 InvalidParameter.KmsNotEnabled The operation failed because KMS is not activated. Please activate KMS in the KMS console and try again.
400 InvalidParameter.Encrypted.KmsNotEnable The operation failed because KMS is not activated. Please activate KMS in the KMS console and try again.
400 InvalidParam.EncryptedMismatch Creating a disk from a shared encrypted image requires encryption with your own KMS key. Please set the Encrypted parameter to true.
400 InvalidTargetTags.NotSupported When the parameter AssociationType is set to AssociatedWithDisk, the TargetTags parameter is not supported.
400 InvalidTargetTagKey.Malformed The specified TargetTag.n.Key [%s] is not valid.
400 InvalidTargetTagValue.Malformed The specified TargetTag.n.Value [%s] is not valid.
400 Duplicate.TargetTagKey Duplicate keys exist in the specified parameter TargetTags. Please ensure key uniqueness.
400 InvalidTargetTag.LimitExceed The number [%s] of the specified parameter TargetTag exceeds the limit [%s].
403 ParameterInvalid The specified RegionId parameter is invalid. The specified region ID is invalid.
403 InvalidParameter.TargetCopyRegions The specified TargetCopyRegions is invalid.
403 InvalidParameter.CopiedSnapshotsRetentionDays The specified CopiedSnapshotsRetentionDays is invalid.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service.
403 Abs.InvalidAction.RegionNotSupport This region does not support this action. The operation is not supported in the region.
403 InvalidOperation.PolicyTypeUnsupported The current policy type does not support this operation. Only custom policies are permitted. The current policy type does not support this operation. Only custom policies allow this operation.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The specified KMS key must be in an enabled state. Please enable the key in the KMS console and try again.
403 InvalidParameter.KMSKeyId.CMKUnauthorized The specified KMS key is not authorized for the ECS service. Please grant the ECS service permission to use the key in the KMS console and try again.
403 InvalidOperation.CopyingDataToThisRegionUnsupported Data transfer to the current region from other regions is not supported. Data transfer to the current region from other regions is not supported.
404 ParameterInvalid The specified automatic snapshot policy does not exist.
404 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.