All Products
Search
Document Center

ApsaraDB RDS:CreateBackup

Last Updated:Feb 29, 2024

Creates a backup file for an instance.

Operation description

Supported database engines

  • MySQL
  • PostgreSQL
  • SQL Server
  • MariaDB

Usage notes

This operation uses the backup feature of ApsaraDB RDS to create a backup set. You can also use an operation of Database Backup (DBS) to create a backup set. For more information, see List of operations by function of DBS.

Precautions

Before you call this operation, make sure that the following requirements are met:

  • The instance is in the Running state.
  • The instance does not have ongoing backup tasks.
  • The number of backup files that are created per day for an instance cannot exceed 20.

References

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
rds:CreateBackupWRITE
  • DBInstance
    acs:rds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
  • rds:ResourceTag
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

The instance ID. You can call the DescribeDBInstances operation to query the instance ID.

rm-uf6wjk5****
DBNamestringNo

The names of the databases whose data you want to back up. Separate the names of the databases with commas (,).

Note You can specify this parameter when you perform a logical backup on individual databases of an ApsaraDB RDS for MySQL instance. You can also specify this parameter when you perform a full physical backup on individual databases of an ApsaraDB RDS for SQL Server instance.
rds_mysql
BackupStrategystringNo

The backup policy. Valid values:

  • db: a database-level backup.
  • instance: an instance-level backup.
Note You can specify this parameter when you perform a logical backup on an ApsaraDB RDS for MySQL instance. You can also specify this parameter when you perform a full physical backup on an ApsaraDB RDS for SQL Server instance.
db
BackupMethodstringNo

The backup type of the instance. Valid values:

  • Logical: logical backup
  • Physical: physical backup
  • Snapshot: snapshot backup

Default value: Physical.

Note
  • You can perform a logical backup only when databases are created on the instance.
  • When you perform a snapshot backup on an ApsaraDB RDS for MariaDB instance, you must set this parameter to Physical.
  • For more information about the supported backup types, see Use the data backup feature.
  • When you perform a snapshot backup on an ApsaraDB RDS for SQL Server instance that uses cloud disks, you must set this parameter to Snapshot.
  • Physical
    BackupTypestringNo

    The backup method. Valid values:

    • Auto: full or incremental backup that is automatically selected
    • FullBackup: full backup

    Default value: Auto.

    Note
  • You must set this parameter only when the instance runs SQL Server.
  • This parameter is valid only when you set the BackupMethod parameter to Physical.
  • Auto
    ResourceGroupIdstringNo

    The resource group ID. You can call the DescribeDBInstanceAttribute to query the resource group ID.

    rg-acfmy*****

    Response parameters

    ParameterTypeDescriptionExample
    object

    The response parameters.

    BackupJobIdstring

    The ID of the backup task.

    5073731
    RequestIdstring

    The ID of the request.

    2C125605-266F-41CA-8AC5-3A643D4F42C5

    Examples

    Sample success responses

    JSONformat

    {
      "BackupJobId": "5073731",
      "RequestId": "2C125605-266F-41CA-8AC5-3A643D4F42C5"
    }

    Error codes

    HTTP status codeError codeError messageDescription
    400BackupType.NotSupportthe specified backup type not supportThis operation is not supported for the specified backup type.
    400InvalidBackupMethod.ValueNotSupportThe specified parameter "BackupMethod" is not valid.The backup method is invalid. Specify a valid backup method. Valid values: Logical and Physical. Default value: Physical. Logical backups are not supported for RDS instances in which no databases are created, and physical backups are supported only for RDS instances that run SQL Server.
    400ReadDBInstanceNotSupportThe operation is not permitted due to type of the instance.-
    400IncorrectDBInstanceLockMode.ValueNotSupportedThe Current DB instance lock mode does not support this operation.The operation failed. The RDS instance is locked.
    400BackupJobExistsA backup job already exists in the specified DB instance.The backup has been created.
    400InvalidPreferredBackupTime.FormatSpecified preferred backup time is not valid.The time of the backup file is invalid. Specify the time in the GMT standard in the YYYY-MM-DDThh:mmZ format. Example: 2012-06-11T15:00Z.
    400InvalidDBName.FormatSpecified DB name is not valid.The database name is invalid. Specify a valid name. The name can be up to 16 characters in length and can contain lowercase letters, digits, and underscores (_). The name must start with a lowercase letter and end with a lowercase letter or a digit.
    403OperationDenied.ApiForbiddenoperation not permitted.The operation is not allowed.
    403IncorrectDBInstanceEngineCurrent DB Instance engine does not support this operation.The operation failed. The operation is not supported for the database engine that is run on the RDS instance.
    403IncorrectDBInstanceTypeCurrent DB instance engine and type does not support operations.The operation failed. The operation is not supported for the database engine of the RDS instance.
    403IncorrectDBInstanceStateCurrent DB instance state does not support this operation.-
    403IncorrectDBInstanceCharacterTypeCurrent DB Instance character_type does not support this operation.This operation is not supported for the character type of the current instance.
    403Exceeded.BackupTimesThe backup times exceeds.The specified BackupTimes parameter is invalid.
    404InvalidDBInstanceName.NotFoundThe database instance does not exist.The name of the RDS instance cannot be found. Check the name of the RDS instance.
    404InvalidDB.NotFoundSpecified db does not exist or DB status does not support this operation.The operation failed. The database cannot be found or is not in a ready state. You can call the DescribeDatabases operation to view the databases of an RDS instance.

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2022-10-28The Error code has changedsee changesets
    Change itemChange content
    Error CodesThe Error code has changed.
      Error Codes 400 change
      Error Codes 403 change
      Added Error Codes: 404