Create a policy.
Operation description
A backup policy configures your backups. When a policy runs, it initiates a backup job to track its progress and outcome. A successful backup job creates a snapshot that you can use to create a restore job.
-
A backup policy supports multiple data sources, including NAS backup, OSS backup, ECS instance backup, ECS file backup, on-premises file backup, Tablestore backup, and CPFS backup.
-
A backup policy can have only one backup schedule with a fixed interval.
-
A backup policy backs up data to a single 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 name of the backup policy. |
Daily local backup + cross-region backup |
|
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. |
Back up once daily at 10:00 AM, with cross-region backup to Shanghai. |
| Rules |
array<object> |
No |
The list of policy rules. |
|
|
array<object> |
No |
A policy rule. |
||
|
RuleType |
string |
Yes |
The type of the rule. Each policy requires at least one BACKUP rule and exactly one TRANSITION rule. Valid values:
|
BACKUP |
|
Schedule |
string |
No |
This parameter is required only when RuleType is set to BACKUP. The backup schedule. Valid formats:
Missed backup jobs are not run retroactively. If a backup job is still running, the next scheduled job is not triggered. |
I|1648647166|P1D |
|
BackupType |
string |
No |
This parameter is required only when RuleType is set to BACKUP. The backup type. The value COMPLETE specifies a full backup. |
COMPLETE |
|
Retention |
integer |
No |
This parameter is required only when RuleType is set to BACKUP, TRANSITION, or REPLICATION. The retention period in days.
|
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 advanced retention rules. |
|
|
object |
No |
An advanced retention rule. |
||
|
AdvancedRetentionType |
string |
No |
The type of the advanced retention rule. Valid values:
|
YEARLY |
|
WhichSnapshot |
integer |
No |
The ordinal number of the backup to keep based on the |
1 |
|
Retention |
integer |
No |
The retention period in days for this advanced rule. The minimum value is 1. |
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 permanently retain at least one backup version. Valid values:
|
1 |
|
Immutable |
boolean |
No |
Valid only when PolicyType is set to UDM_ECS_ONLY. Specifies whether to enable backup lock for the backups. |
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. |
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, the filter matches any value for the specified tag key. |
prod |
|
Operator |
string |
No |
The operator for matching tags. Valid values:
|
EQUAL |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
CreatePolicyResponse |
||
|
Success |
boolean |
Indicates whether the request succeeded. Valid values:
|
true |
|
Code |
string |
The return code. A value of |
200 |
|
Message |
string |
The response message. |
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.