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