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
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:ModifyAutoSnapshotPolicyEx |
update |
*Snapshot
|
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:
|
["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:
|
["1", "7"] |
| retentionDays |
integer |
No |
The retention period of automatic snapshots. Unit: days. Valid values:
Default value: -1. |
30 |
| EnableCrossRegionCopy |
boolean |
No |
Specifies whether to allow automatic cross-region replication.
|
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:
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:
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.