All Products
Search
Document Center

Elastic Compute Service:ModifyAutoSnapshotPolicyEx

Last Updated:Jun 18, 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 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 in the format of "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 in the format of "1", "2", … "7". Separate the days with commas (,).

["1", "7"]

retentionDays

integer

No

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

  • -1: permanently retained.

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

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 for cross-region snapshot replication. You can set one destination region.

["cn-hangzhou"]

CopiedSnapshotsRetentionDays

integer

No

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

  • -1: permanently retained.

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

Default value: -1.

30

CopyEncryptionConfiguration

object

No

The encryption parameter for cross-region snapshot replication.

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

Arn

array<object>

No

This parameter is not publicly available.

object

No

RoleType

string

No

This parameter is not publicly available.

hide

Rolearn

string

No

This parameter is not publicly available.

hide

AssumeRoleFor

integer

No

This parameter is not publicly available.

1000000000

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 specified parameter Encrypted must be true when kmsKeyId is not empty. The encryption feature is not enabled after a Key Management Service (KMS) key ID is specified.
400 InvalidParameter.KmsNotEnabled Failed to perform this operation because KMS is not activated. You need to activate KMS key management service.
400 InvalidParameter.Encrypted.KmsNotEnable Failed to perform this operation because KMS is not activated. You need to activate KMS key escrow service.
400 InvalidParam.EncryptedMismatch Creating encrypted disks with shared encrypted image requires replacing encryption keys. You must change the encryption key to create a cloud disk after sharing an encrypted image.
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 have no right to access your KMS. ECS is not authorized to access your KMS resources.
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 CMK (Customer Master Key) must be in an active state. The CMK (Customer Master Key) must be in an active state.
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK(Customer Master Key) lacks authorization to add tags to the ECS service. The CMK(Customer Master Key) lacks authorization to add tags to the ECS service.
404 ParameterInvalid The specified automatic snapshot policy does not exist.
404 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. The specified KMSKeyId parameter does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.