All Products
Search
Document Center

Hybrid Backup Recovery:CreateBackupPlan

Last Updated:Nov 14, 2022

Creates a backup plan.

Operation Description

  • A backup plan defines the data source, backup policy, and other configurations. After you execute a backup plan, a backup job is generated to record the backup progress and the backup result. If a backup job is completed, a backup snapshot is generated. You can use a backup snapshot to create a restore job.
  • You can specify only one type of data source in a backup plan.
  • You can specify only one interval as a backup cycle in a backup plan.
  • Each backup plan allows you to back up data to only one backup vault.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
SourceTypestringYes

The type of the data source. Valid values:

  • ECS_FILE: Elastic Compute Service (ECS) files
  • OSS: Object Storage Service (OSS) buckets
  • NAS: Apsara File Storage NAS file systems
ECS_FILE
PlanNamestringYes

The name of the backup plan. The name must be 1 to 64 characters in length. The name of a backup plan for each type of data source must be unique within a backup vault.

planname
BackupTypestringYes

The backup type. Valid value: COMPLETE, which indicates full backup.

COMPLETE
VaultIdstringYes

The ID of the backup vault.

v-0006******q
SchedulestringYes

The backup policy. Format: I|{startTime}|{interval}. The system runs the first backup job at a point in time that is specified in the {startTime} parameter and the subsequent backup jobs at an interval that is specified in the {interval} parameter. The system does not run a backup job before the specified point in time. Each backup job, except the first one, starts only after the previous backup job is completed. For example, I|1631685600|P1D specifies that the system runs the first backup job at 14:00:00 on September 15, 2021 and the subsequent backup jobs once a day.

  • startTime: the time at which the system starts to run a backup job. The time must follow the UNIX time format. Unit: seconds.
  • interval: the interval at which the system runs a backup job. The interval must follow the ISO8601 standard. For example, PT1H indicates an interval of 1 hour. P1D indicates an interval of one day.
I|1602673264|P1D
RetentionlongYes

The retention period of backup data. Minimum value: 1. Unit: days.

7
FileSystemIdstringNo

This parameter is required only if the SourceType parameter is set to NAS. This parameter specifies the ID of the NAS file system.

005494
CreateTimelongNo

This parameter is required only if the SourceType parameter is set to NAS. This parameter specifies the time to create the file system. This value must be a UNIX timestamp. Unit: seconds.

1607436917
BucketstringNo

This parameter is required only if the SourceType parameter is set to OSS. This parameter specifies the name of the OSS bucket.

hbr-backup-oss
PrefixstringNo

This parameter is required only if the SourceType parameter is set to OSS. This parameter specifies a prefix. After a prefix is specified, only objects whose names start with the prefix are backed up.

oss-prefix
InstanceIdstringNo

This parameter is required only if the SourceType parameter is set to ECS_FILE. This parameter specifies the ID of the ECS instance.

i-m5e*****6q
DetailobjectNo

The detail about the ECS instance backup, the format of value type is JSON.

  • snapshotGroup: whether to use a snapshot-consistent group (only enhanced SSDs (ESSDs)).
  • appConsistent: whether to enable the application-consistent backup feature (use with preScriptPath and postScriptPath only).
  • preScriptPath: the pre-freeze scripts path.
  • postScriptPath: the post-thaw scripts path.
UdmRegionIdstringNo

The region id of an ECS instance backup.

cn-shanghai
SpeedLimitstringNo

This parameter is required only if the SourceType parameter is set to ECS_FILE. This parameter specifies the throttling rules. Format: {start}|{end}|{bandwidth}. Separate multiple throttling rules with vertical bars (|). A specified time range cannot overlap with another time range.

  • start: the start time.
  • end: the end time.
  • bandwidth: the bandwidth. Unit: KB/s.
0:24:5120
IncludestringNo

This parameter is required only if the SourceType parameter is set to ECS_FILE. This parameter specifies the paths to the files that you want to back up. The value must be 1 to 255 characters in length.

["/home/alice/*.pdf", "/home/bob/*.txt"]
ExcludestringNo

This parameter is required only if the SourceType parameter is set to ECS_FILE. This parameter specifies the paths to the files that are excluded from the backup job. The value must be 1 to 255 characters in length.

["/var", "/proc"]
OptionsstringNo

This parameter is required only if the SourceType parameter is set to ECS_FILE. This parameter specifies whether to use Windows VSS to define a backup path.

  • This parameter is available only for Windows ECS instances.
  • If data changes occur in the backup source, the source data must be the same as the data to be backed up before the system sets this parameter to ["UseVSS":true].
  • If you use VSS, you cannot back up data from multiple directories.
{"UseVSS":false}
PatharrayNo

The backup paths.

stringNo

The backup paths. The value must be 1 to 65,536 characters in length.

Specify backup paths based on the following rules:

  • If you do not use wildcards (*), you can enter up to 20 backup paths.
  • If you use wildcards (*), you can enter only a single path. The path can be in the /*/* format.
  • Only absolute paths are supported.
  • If you use VSS, you can enter only one path. UNC paths and wildcards (*) are not supported. You cannot exclude files from the backup plan.
  • If you use UNC, VSS paths and wildcards (*) are not supported. You cannot exclude files from the backup plan. If a UNC path is specified, HBR does not back up the access control list (ACL) of Windows.
["/home"]
RulearrayNo

The list of backup policies. This parameter is returned only for disk backup.

objectNo

The list of backup policies. This parameter is returned only for disk backup.

DestinationRetentionlongNo

The retention period of backup data.

7
SchedulestringNo

The backup policy. Format: I|{startTime}|{interval}. The system runs the first backup job at a point in time that is specified in the {startTime} parameter and the subsequent backup jobs at an interval that is specified in the {interval} parameter. The system does not run a backup job before the specified point in time. Each backup job, except the first one, starts only after the previous backup job is completed. For example, I|1631685600|P1D specifies that the system runs the first backup job at 14:00:00 on September 15, 2021 and the subsequent backup jobs once a day.

  • startTime: the time at which the system starts to run a backup job. The time must follow the UNIX time format. Unit: seconds.
  • interval: the interval at which the system runs a backup job. The interval must follow the ISO8601 standard. For example, PT1H indicates an interval of 1 hour. P1D indicates an interval of one day.
C|0|0 0 18 1 1 ?
RetentionlongNo

The retention period of backup data.

7
DisabledbooleanNo

Indicates whether the policy is disabled.

false
DoCopybooleanNo

Indicates whether the snapshot data is backed up to the backup vault.

false
DestinationRegionIdstringNo

The ID of the region where the remote backup vault resides.

cn-hangzhou
RuleNamestringNo

The name of the policy.

rule-test-name
BackupTypestringNo

The backup type. Valid value: COMPLETE, which indicates full backup.

COMPLETE
InstanceNamestringNo

The name of the Tablestore instance.

instancename
OtsDetailOtsDetailNo

The details about the Tablestore instance.

Response parameters

ParameterTypeDescriptionExample
object

The reponse body.

Codestring

The HTTP status code. The status code 200 indicates that the call is successful.

200
Messagestring

The message that is returned. If the call is successful, "successful" is returned. If the call fails, an error message is returned.

successful
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
PlanIdstring

The ID of the backup plan.

plan-*********************
Successboolean

Indicates whether the call is successful.

  • true: The call is successful.
  • false: The call fails.
true

Example

Request example

http(s)://[Endpoint]/?Action=CreateBackupPlan
&SourceType=ECS_FILE
&PlanName=planname
&BackupType=COMPLETE
&VaultId=v-0006******q
&Schedule=I|1602673264|P1D
&Retention=7
&FileSystemId=005494
&CreateTime=1607436917
&Bucket=hbr-backup-oss
&Prefix=oss-prefix
&InstanceId=i-m5e*****6q
&SpeedLimit=0:24:5120
&Include=["/home/alice/*.pdf", "/home/bob/*.txt"]
&Exclude=["/var", "/proc"]
&Options={"UseVSS":false}
&Path=["[\"/home\"]"]
&InstanceName=instancename
&OtsDetail={"TableNames":[]}
&Common request parameters

Normal return example

JSONFormat

{
  "Code": "200",
  "Message": "successful",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "PlanId": "plan-*********************",
  "Success": true
}

Error codes

For a list of error codes, visit the API error center.

Change history

Change timeSummary of changesOperate
2022-02-21The input parameters of the API operation has changed
Change itemChange content
Input ParametersThe input parameters of the API operation has changed
    Added Input Parameters: InstanceGroupId
2022-02-21The internal configurations of the API operation has changed but you can still call the operation.
Change itemChange content
The internal configurations of the API operation has changed but you can still call the operation.