All Products
Search
Document Center

Cloud Backup:CreateBackupPlan

Last Updated:Nov 06, 2024

Creates a backup plan.

Operation description

  • A backup schedule defines the data source, backup policy, and other configurations. After you execute a backup schedule, a backup job is generated to record the backup progress and the backup result. If a backup job is complete, 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 schedule.
  • You can specify only one interval as a backup cycle in a backup schedule.
  • Each backup schedule allows you to back up data to only one backup vault.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hbr:CreateBackupPlancreate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
SourceTypestringYes

The type of the data source. Valid values:

  • ECS_FILE: backs up Elastic Compute Service (ECS) files.
  • OSS: backs up Object Storage Service (OSS) buckets.
  • NAS: backs up Apsara File Storage NAS file systems.
  • OTS: backs up Tablestore instances.
  • UDM_ECS: backs up ECS instances.
ECS_FILE
PlanNamestringYes

The name of the backup schedule. The name must be 1 to 64 characters in length. The name of a backup schedule 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
VaultIdstringNo

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 complete. 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 ISO 8601 standard. For example, PT1H specifies an interval of one hour. P1D specifies 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. The 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 the prefix of objects that you want to back up. 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 details about ECS instance backup. The value is a JSON string.

  • snapshotGroup: specifies whether to use a snapshot-consistent group. This parameter is valid only if all disks of the ECS instance are enhanced SSDs (ESSDs).
  • appConsistent: specifies whether to enable application consistency. If you set this parameter to true, you must also specify the preScriptPath and postScriptPath parameters.
  • preScriptPath: the path to the prescript file.
  • postScriptPath: the path to the postscript file.
{\"EnableFsFreeze\":true,\"appConsistent\":false,\"postScriptPath\":\"\",\"preScriptPath\":\"\",\"snapshotGroup\":true,\"timeoutInSeconds\":60}
UdmRegionIdstringNo

The region in which the ECS instance that you want to back up resides.

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 hour.
  • end: the end hour.
  • 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 can be up 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 can be up 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 Volume Shadow Copy Service (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 path. The value can be up to 65,536 characters in length. Specify backup paths based on the following rules:

  • If you do not use wildcards (*), you can specify up to 20 backup paths.
  • If you use wildcards (*), you can specify only one backup path and you must specify the backup path in the /*/* format.
  • Only absolute paths are supported.
  • If you use VSS, you can specify only one path. Universal Naming Conversion (UNC) paths and wildcards (*) are not supported. You cannot exclude files from the backup schedule.
  • If you use UNC, VSS paths and wildcards (*) are not supported. You cannot exclude files from the backup schedule. If a UNC path is specified, Hybrid Backup Recovery (HBR) does not back up the access control list (ACL) of Windows.
["/home"]
Rulearray<object>No

The rules of the backup schedule.

objectNo

The rule of the backup schedule.

DestinationRetentionlongNo

The retention period of the backup data in geo-redundancy mode. Unit: days.

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 complete. 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 ISO 8601 standard. For example, PT1H specifies an interval of one hour. P1D specifies an interval of one day.

I|1602673264|P1D
RetentionlongNo

The retention period of the backup data. Unit: days.

7
DisabledbooleanNo

Specifies whether to enable the rule.

false
DoCopybooleanNo

Specifies whether to enable cross-region replication.

false
DestinationRegionIdstringNo

The ID of the region to which data is replicated.

cn-hangzhou
RuleNamestringNo

The name of the rule.

rule-test-name
BackupTypestringNo

The backup type.

COMPLETE
InstanceNamestringNo

The name of the Tablestore instance.

instancename
OtsDetailOtsDetailNo

The details about the Tablestore instance.

CrossAccountTypestringNo

Specifies whether data is backed up and restored within the same Alibaba Cloud account or across Alibaba Cloud accounts. Valid values:

  • SELF_ACCOUNT: Data is backed up and restored within the same Alibaba Cloud account.
  • CROSS_ACCOUNT: Data is backed up and restored across Alibaba Cloud accounts.
CROSS_ACCOUNT
CrossAccountUserIdlongNo

The ID of the source Alibaba Cloud account that authorizes the current Alibaba Cloud account to back up and restore data across Alibaba Cloud accounts.

15897534xxxx4625
CrossAccountRoleNamestringNo

The name of the RAM role that is created within the source Alibaba Cloud account and assigned to the current Alibaba Cloud account to authorize the current Alibaba Cloud account to back up and restore data across Alibaba Cloud accounts.

BackupRole
KeepLatestSnapshotslongNo

Specifies whether to enable the "Keep at least one backup version" feature. Valid values:

  • 0: The feature is disabled.
  • 1: The feature is enabled.
1
ChangeListPathstringNo

The configurations of the incremental file synchronization. This parameter is required for data synchronization only.

{"dataSourceId": "ds-123456789", "path": "/changelist"}
DisabledbooleanNo

Specifies whether to disable the plan by default.

true

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

Codestring

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

200
Messagestring

The message that is returned. If the request is successful, a value of successful is returned. If the request fails, an error message is returned.

successful
RequestIdstring

The ID of the request.

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

The ID of the backup schedule.

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

Indicates whether the request is successful.

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

Examples

Sample success responses

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 Service error codes.

Change history

Change timeSummary of changesOperation
No change history