All Products
Search
Document Center

Elastic Compute Service:ModifyAutoSnapshotPolicyEx

Last Updated:Nov 14, 2024

Modifies an automatic snapshot policy. After an automatic snapshot policy is modified, the modifications immediately take effect on the disks that are associated with the policy. If cross-region replication for snapshots is enabled and no encryption parameters are configured, the generated encrypted snapshot copies are encrypted by using the Key Management Service (KMS) encryption keys in the region to which the snapshots are copied.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:ModifyAutoSnapshotPolicyExupdate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
regionIdstringYes

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

cn-hangzhou
autoSnapshotPolicyIdstringYes

The name of the automatic snapshot policy. If this parameter is not specified, the original name of the automatic snapshot policy is retained.

sp-bp12m37ccmxvbmi5****
autoSnapshotPolicyNamestringNo

The points in time of the day at which to create automatic snapshots. The time must be in UTC+8. Unit: hours. Valid values are 0 to 23, which correspond to the 24 points in time on the hour from 00:00:00 to 23:00:00. For example, a value of 1 indicates 01:00:00.

To schedule multiple automatic snapshots to be created in a day, you can specify multiple hours.

  • You can specify up to 24 points in time.
  • You must set this parameter to a JSON array such as ["0", "1", ... "23"]. Separate the points in time with commas (,).
SPTestName
timePointsstringNo

The days of the week on which to create automatic snapshots. Valid values are 1 to 7, which correspond to the days of the week. For example, a value of 1 indicates Monday.

To schedule multiple automatic snapshots to be created in a week, you can specify multiple days.

  • You can specify up to seven days over a one-week period.
  • You must set this parameter to a JSON array such as ["1", "2" ... "7"]. Separate the values in the array with commas (,).
["0", "1"]
repeatWeekdaysstringNo

The retention period of the automatic snapshot. Unit: days. Valid values:

  • -1: The automatic snapshot is permanently retained.
  • 1 to 65536: The auto snapshot is retained for the specified number of days.

Default value: -1.

["1", "7"]
retentionDaysintegerNo

Specifies whether to enable cross-region replication for the automatic snapshot.

  • true: enables cross-region replication for the automatic snapshot.
  • false: disables cross-region replication for the automatic snapshot.
30
EnableCrossRegionCopybooleanNo

The destination region to which to copy the snapshot. You can specify only a single destination region.

false
TargetCopyRegionsstringNo

The retention period of the snapshot copy in the destination region. Unit: days. Valid values:

  • -1: The snapshot is permanently retained.
  • 1 to 65535: The automatic snapshot is retained for the specified number of days.

Default value: -1.

["cn-hangzhou"]
CopiedSnapshotsRetentionDaysintegerNo

The ID of the request.

30
CopyEncryptionConfigurationobjectNo

The encryption configurations for cross-region snapshot replication.

EncryptedbooleanNo

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

  • true
  • false

Default value: false.

false
KMSKeyIdstringNo

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

0e478b7a-4262-4802-b8cb-00d3fb40826X
Arnarray<object>No

This parameter is not publicly available.

objectNo
RoleTypestringNo

This parameter is not publicly available.

hide
RolearnstringNo

This parameter is not publicly available.

hide
AssumeRoleForlongNo

This parameter is not publicly available.

1000000000

Response parameters

ParameterTypeDescriptionExample
object

The ID of the request.

RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.EncryptedIllegalThe 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.
400InvalidParameter.KMSKeyId.CMKNotEnabledThe CMK needs to be enabled.The customer master key (CMK) is not enabled when KMSKeyId is specified for an encrypted disk. You can call the DescribeKey operation of KMS to query information about the specified CMK.
400InvalidParameter.KmsNotEnabledFailed to perform this operation because KMS is not activated.You need to activate KMS key management service.
400InvalidParameter.Encrypted.KmsNotEnableFailed to perform this operation because KMS is not activated.You need to activate KMS key escrow service.
400InvalidParam.EncryptedMismatchCreating 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.
403ParameterInvalidThe specified RegionId parameter is invalid.The specified region ID is invalid.
403ParameterInvalidThe specified RepeatWeekDays parameter is invalid.The specified RepeatWeekdays parameter is invalid.
403ParameterInvalidThe specified TimePoints parameter is invalid.The specified TimePoints parameter is invalid.
403ParameterInvalidThe specified AutoSnapshotPolicyId is invalid.The specified automatic snapshot policy ID is invalid.
403ParameterInvalidThe specified RetentionDays parameter is invalid.The specified RetentionDays parameter is invalid.
403InvalidParameter.TargetCopyRegionsThe specified TargetCopyRegions is invalid.-
403InvalidParameter.CopiedSnapshotsRetentionDaysThe specified CopiedSnapshotsRetentionDays is invalid.-
403InvalidParameter.KMSKeyId.CMKUnauthorizedThe CMK needs to be added ECS tag.-
403InvalidParameter.KMSKeyId.KMSUnauthorizedECS service have no right to access your KMS.ECS is not authorized to access your KMS resources.
403Abs.InvalidAction.RegionNotSupportThis region does not support this action.The operation is not supported in the region.
403InvalidOperation.PolicyTypeUnsupportedThe 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.
404ParameterInvalidThe specified automatic snapshot policy does not exist.The specified automatic snapshot policy does not exist.
404ParameterInvalidThe specified automatic snapshot policy does not exist in the region.The specified automatic snapshot policy does not exist.
404InvalidParameter.KMSKeyId.NotFoundThe specified KMSKeyId does not exist.The specified KMSKeyId parameter does not exist.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-11-05The Error code has changedView Change Details
2024-03-21The Error code has changedView Change Details
2024-02-29The Error code has changedView Change Details
2024-02-28The Error code has changedView Change Details
2024-02-28The Error code has changed. The request parameters of the API has changedView Change Details