Creates a backup policy.
Operation description
A backup policy contains the information required for a backup. When a backup policy is executed, a backup job is generated to record the backup progress and result. If the backup job is successful, a backup snapshot is created. You can use the backup snapshot to create a restore job.
-
A backup policy can be applied to multiple types of data sources. Currently, only Elastic Compute Service (ECS) instance backup is supported.
-
A backup policy can have only one backup cycle with a fixed interval.
-
A backup policy can back up data to only one backup vault.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hbr:CreatePolicyV2 |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| PolicyName |
string |
No |
The policy name. |
每天本地备份 + 异地备份 |
| PolicyType |
string |
No |
The type of the backup policy. Valid values:
If you do not specify this parameter, Cloud Backup automatically sets the policy type based on whether a backup vault is specified in the policy rules:
|
STANDARD |
| PolicyDescription |
string |
No |
The description of the backup policy. |
每天早上10点备份一次,异地备份到上海。 |
| Rules |
array<object> |
No |
The list of policy rules. |
|
|
array<object> |
No |
The policy rule. |
||
| RuleType |
string |
Yes |
The type of the rule. Each policy must have at least one rule of the BACKUP type and only one rule of the TRANSITION type.
|
BACKUP |
| Schedule |
string |
No |
This parameter is required only when RuleType is set to BACKUP. The backup schedule. The format is as follows:
Backup jobs that are overdue are not performed. If the last backup job is not complete, the next backup job is not triggered. |
I|1648647166|P1D |
| BackupType |
string |
No |
This parameter is required only when RuleType is set to BACKUP. The backup type. Set the value to COMPLETE. This value indicates a full backup. |
COMPLETE |
| Retention |
integer |
No |
This parameter is required only when RuleType is set to BACKUP, TRANSITION, or REPLICATION.
|
7 |
| ReplicationRegionId |
string |
No |
This parameter is required only when RuleType is set to REPLICATION. The ID of the destination region for replication. |
cn-shanghai |
| RetentionRules |
array<object> |
No |
This parameter is required only when RuleType is set to TRANSITION. The special retention rules. |
|
|
object |
No |
The special retention rule. |
||
| AdvancedRetentionType |
string |
No |
The type of the special retention rule. Valid values:
|
YEARLY |
| WhichSnapshot |
integer |
No |
Specifies which backup is retained. This parameter is applicable to the first backup. Set the value to 1. |
1 |
| Retention |
integer |
No |
The special retention period of the backup. The value must be an integer that is greater than or equal to 1. Unit: days. |
730 |
| VaultId |
string |
No |
This parameter is required only when RuleType is set to BACKUP. The ID of the backup vault. |
v-0001************aseg |
| KeepLatestSnapshots |
integer |
No |
Specifies whether to retain the latest backup version.
|
1 |
| Immutable |
boolean |
No |
This parameter is valid only when PolicyType is set to UDM_ECS_ONLY. This parameter specifies whether to enable backup locking. |
true |
| DataSourceFilters |
array<object> |
No |
This parameter is required only when RuleType is set to TAG. The filter rules for data sources. |
|
|
object |
No |
|||
| SourceType |
string |
No |
The type of the data source. Valid values:
|
UDM_ECS |
| DataSourceIds |
array |
No |
This parameter is deprecated. |
|
|
string |
No |
This parameter is deprecated. |
已废弃。 |
|
| TagFilters |
array<object> |
No |
This parameter is required only when RuleType is set to TAG. The filter rules for resource tags. |
|
|
object |
No |
|||
| Key |
string |
No |
The tag key. |
env |
| Value |
string |
No |
The tag value. If you leave this parameter empty, all tag values are matched. |
prod |
| Operator |
string |
No |
The tag matching rule. Valid values:
|
EQUAL |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
CreatePolicyResponse |
||
| Success |
boolean |
Indicates whether the request was successful.
|
true |
| Code |
string |
The return code. A value of 200 indicates that the request was successful. |
200 |
| Message |
string |
The message that is returned. If the request was successful, "successful" is returned. If the request failed, an error message is returned. |
successful |
| RequestId |
string |
The request ID. |
EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F |
| PolicyId |
string |
The policy ID. |
po-000000zemnuyx2li3y9y |
Examples
Success response
JSON format
{
"Success": true,
"Code": "200",
"Message": "successful",
"RequestId": "EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F",
"PolicyId": "po-000000zemnuyx2li3y9y"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.