All Products
Search
Document Center

ApsaraDB RDS:Download backup files

Last Updated:Jan 11, 2024

This topic describes how to download the backup files of an ApsaraDB RDS for PostgreSQL instance. You can use the backup files in the scenarios such as long-term retention of backup files, backup queries, data migration, and audit.

Billing rules

If your RDS instance uses local disks and you download the backup files of the RDS instance, you are charged for the Internet traffic that you consume to download the backup files. If your RDS instance uses cloud disks and you download the backup files of the RDS instance, you are charged for the Internet traffic that you consume to download the backup files and backup file conversion.

Traffic fees

  • Downloads over an internal network: You are not charged for the traffic that you consume.

  • Downloads over the Internet: After the free quota of 500 GB per instance-month is exhausted, you are charged for the excess traffic that you consume based on the pay-as-you-go billing method. Fees are deducted from your account on a daily basis. For more information, see Network traffic fees.

Note
  • When you start a task to download the snapshot backup file of an RDS instance that uses cloud disks, the system converts the backup file and generates a download task. If the task is not complete, the download URL cannot be obtained. In this case, you are not charged for Internet traffic. In-progress tasks and failed tasks are considered not complete. After the task is complete, you are charged for the traffic generated when you download the backup file by using the URL.

  • When you download the physical backup file of an RDS instance that uses local disks, the system does not convert the backup file and directly provides you with the download URL. You are charged for the traffic generated when you download the backup file by using the URL.

  • To view the volume of traffic that you consumed to download backup files over the Internet, you can log on to the ApsaraDB RDS console, find your RDS instance, and then click the ID of the instance to go to the Basic Information page of the RDS instance. Then, you can view the Backup Downloads parameter in the Usage Statistics section of the page.

  • We recommend that you purchase a subscription network plan to offset the fee for the Internet traffic that is used to download the backup files. A large capacity of a network plan indicates a high discount. For more information, see Use network plans.

Backup set conversion fee

If you use the advanced download feature, the snapshot backup files are converted into CSV, SQL, or Parquet files, and you are charged for backup set conversions. No free quota is provided for backup set conversion. The following table describes the unit prices for backup set conversion in different regions.

Region

Unit price (USD per GB)

Public cloud

0.03125

Note

When you start a task to download the snapshot backup file of an RDS instance that uses cloud disks, the system generates a task to convert the backup file. If the conversion task fails, you are not charged for backup set conversion.

Download methods

RDS instances that use cloud disks

You can create an advanced download task by point in time or backup set based on the RDS edition and instance type of your RDS instance. You can set the Download Destination parameter to URL or directly upload the downloaded data to your Object Storage Service (OSS) bucket to facilitate data analysis and offline archiving.

Prerequisites

  • Your RDS instance meets the following requirements:

    • The RDS instance runs PostgreSQL 10 or later.

    • The RDS instance uses the enhanced SSD (ESSD) storage type. General-purpose ESSDs are not supported.

    Note
    • You can go to the Basic Information page of your RDS instance to obtain the preceding information.

    • If your RDS instance uses the local SSD or standard SSD storage type and you want to use this feature, you can upgrade the major engine version of the RDS instance to upgrade the storage type to ESSD. For more information, see Upgrade the major engine version of an ApsaraDB RDS for PostgreSQL instance.

  • Your RDS instance resides in one of the following regions: China (Chengdu), China (Guangzhou), China (Qingdao), China (Beijing), China (Shanghai), China (Zhangjiakou), China (Hangzhou), China (Shenzhen), China (Hong Kong), Malaysia (Kuala Lumpur), Indonesia (Jakarta), Japan (Tokyo), Singapore, US (Silicon Valley), and US (Virginia).

    Note

    The feature will be available in other regions soon.

  • You must go to the Cloud Resource Access Authorization page to authorize Database Backup (DBS) to access resources in your Alibaba Cloud account.

Feature matrix

RDS edition

Instance type

Database engine

Download by backup set

Download by point in time

RDS High-availability Edition

Dedicated instance types

PostgreSQL 10 or later with the ESSD storage type

Supported

Not supported

General-purpose instance types

Supported

Supported

RDS Basic Edition

New general-purpose instance types

Supported

Not supported

General-purpose instance types

Supported

Not supported

Limits

  • The following objects in schemas are involved:

    • Supported: tables, indexes, user-defined data types, unique constraints, foreign key constraints, NOT NULL constraints, and table inheritance

    • Not supported: CHECK constraints

  • The following data types are supported:

    Numeric, string, datetime, Boolean type, enumerated type, array, UUID, jsonb, and bytea

    Note

    Parquet files must be converted to strings.

  • The following types of primary keys are supported:

    SMALLINT, Integer, BigInt, SMALLSERIAL, SERIAL, BIGSERIAL, CHAR, VARCHAR, and composite primary key. In addition, tables that do not have primary keys are also supported.

  • The following system databases cannot be exported:

    template1, template0, and rdsadmin

  • The following system tables cannot be exported:

    information_schema and pg_catalog

  • If you set the Download Destination parameter to OSS, only the Standard storage class is supported. For more information about how to change the storage class, see Convert storage classes.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane, click Backup and Restoration.

  3. On the page that appears, choose Base Backups > Data Backup, find the backup set that you want to download, and then click Download Instance Backup in the Actions column.

    Note

    By default, the ApsaraDB RDS console displays the backup files that were generated over the most recent eight days. If you want to view the backup files that were generated eight days ago, you must change the time range.

  4. In the Point in Time and Backup Set step of the wizard, select Download by Point in Time or Download by Backup Set and click Next.

    Note

    The Download by Point in Time option is available only when the log backup feature is enabled for your RDS instance. For more information about how to enable the log backup feature, see Use the log backup feature.

  5. In the Instance Database, and Table step of the wizard, click Next.

    Note

    Download Instances is selected by default.

  6. In the Destination and Format step of the wizard, configure the following parameters and click Complete.

    Note

    We recommend that you set the Download Destination parameter to OSS. This method is efficient.

    • Set the Download Destination parameter to URL.

      Configure the Download Format parameter. Then, read and select the required content.

    • Set the Download Destination parameter to OSS.

      1. Configure the Bucket Name and Directory Prefix parameters. OSS

      2. Configure the Download Format parameter.

      3. Read and select the required content.

    Note
    • You can set the Download Format parameter to CSV, SQL, or Parquet.

    • If you do not have the permissions to access OSS resources, follow the instructions in the console and click Authorize and then Confirm Authorization Policy. After the permissions are granted, configure the parameters for the advanced download task.

  7. Go to the Backup Download tab.

    Important
    • Computing resources are competed to convert the downloaded backup sets. As a result, temporary resource allocation may fail, and the download task fails. The download task may also fail due to special data formats. If your download task fails, try again or contact DBS technical support.

    • No fees are generated for failed tasks.

    • If you set the Download Destination parameter to URL and the task status changes to Finished, perform the following steps:

      1. Click Generate Link in the Download Destination column.

      2. In the Generate Link dialog box, configure the Validity Period parameter and click Generate Link. Then, you can download backup data by using the generated URL.

        Note
        • If you set the Download Destination parameter to URL, the downloaded data is temporarily stored in the built-in storage of DBS. For more information, see Built-in storage and OSS.

        • The validity period of the URL ranges from 5 minutes to 1 day. The default validity period is 2 hours.

        • You can obtain the download URL within three days after the download task is complete. After the URL expires, the downloaded data is deleted. If you want to use the data, you must initiate a new download task and obtain the new download URL.

        • A download URL is generated based on the validity period that you specify. We recommend that you save the URL at the earliest opportunity and keep the URL confidential.

        • If you use a third-party download tool to download the backup file, additional download traffic may be generated. As a result, you may be charged additional fees. Proceed with caution.

        • For more information about how to download a backup file, see Appendix: Download commands.

        • When you perform an advanced download, backup file conversion fees and traffic fees are generated. For more information, see Billing rules.

    • If the Download Destination parameter is set to OSS and the status of the task changes from Running to Finished, the download is successful. You can view and use the downloaded file in the specified OSS bucket.

      Note

      If you use this method, data is directly downloaded to your OSS bucket, and you can use and delete the data based on your business requirements.

RDS instances that use local disks

Prerequisites

  • The RDS instance uses local disks.

    Note

    You can go to the Basic Information page to view the preceding information about the RDS instance.

  • The RAM user that you want to use to log on to your RDS instance is granted the permissions to download backup files. For more information about how to grant permissions to a RAM user, see Grant backup file download permissions to a RAM user with read-only permissions.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane of the page that appears, click Backup and Restoration.

  3. Click the Data Backup or Log Backup (origin: Archived Logs) tab.

    • If you want to download a data backup file, choose Base Backups > Data Backup.

    • If you want to download a log backup file, choose Base Backups > Log backup (Previously Archived Logs).

  4. Select a time range. This step is required if you want to view the backup files that are generated eight days ago. The default time range spans the most recent eight days.

  5. Find the backup file that you want to download and click Download Instance Backup in the Actions column.

    Note
    • If Download Instance Backup is not displayed, check whether all prerequisites are met.

    • If you want to download data backup file and use the backup file to restore data, we recommend that you select the data backup file that is created at the point in time closest to the point in time at which the required data exists.

    • If you want to download an archived log backup file and use the file to restore data to an on-premises database, take note of the following items:

      • The instance No. of the archived log backup file must be the same as that of the data backup file that is used with the archived log backup file.

      • The start time of the log backup file must be later than the end time of the data backup file and earlier than the specified point in time for data restoration.

  6. In the dialog box that appears, click Download or copy the URL that you can use to download the backup file.

    • Copy Internal URL: If your VPC-type Elastic Compute Service (ECS) instance can communicate with the RDS instance over an internal network, you can log on to your ECS instance and use the internal URL to download the log backup file. This method is faster and more secure.

    • Copy Public URL: If the RDS instance cannot be connected over an internal network, you can use the public URL to download the log backup file.

    Note
    • The download URLs are valid only for one hour after it is generated. If the download URL expires, you can refresh the page to obtain the latest download URL.

    • If you use the internal URL to download the log backup file, make sure that the server to which you log on and the RDS instance reside in the same VPC. If the server and the RDS instance reside in VPCs of different regions or if the server resides in the classic network while the RDS instance resides in a VPC, you cannot download the log backup file by using the internal URL on the server.

    • If you download the backup file over the Internet, you are charged for the Internet traffic that exceeds the free quota. For more information, see Billing rules.

Appendix: Download commands

This section describes the commands that are commonly used to download backup files.

Note
  • If the speed of a download is lower than 64 KB per second, the download may be interrupted. When you download a backup file, we recommend that you ensure optimal network status.

  • If you want to download a backup file to a disk that is attached by using ossfs, you must adjust the value of the multipart_size parameter for ossfs. The maximum value of this parameter is 100 GB. If the size of the backup file that you want to download exceeds 100 GB, the download fails. For more information about ossfs and its parameter settings, see Overview and Common options.

  • We recommend that you use the commands, such as wget and curl, that are provided in this topic to download a backup file. If you use a third-party tool to download a backup file, the backup file may be downloaded multiple times. As a result, the amount of data that is downloaded is greater than the size of the backup file, and you may be charged for the traffic that is consumed to download the excess amount of data over the Internet.

wget

Command: nohup wget -c -t 0 "The URL that is used to download the backup file" -O The save path and name of the backup file that you want to download > The file to which the downloaded data is saved &
Example: nohup wget -c -t 0 "https://example.aliyundoc.com/examplebackup.qp.xb" -O /backup/examplebackup.qp.xb > /tmp/download.log &
The following information provides the meanings of the options in the preceding command:
-t 0: enables an unlimited number of retries. 
-c: enables resumable uploads. 
-O: specifies the save path and name of the backup file that you want to download. 
nohup: prevents interruptions to the download and specifies that the process automatically exits after the download is complete. If you accidentally replicate data or disconnect your database client during the download, the download is interrupted.

curl

Command: nohup curl -C --- retry 10 "The URL that is used to download the backup file" -o The user-defined name of the downloaded backup file> The file to which the downloaded data is saved&
Example: nohup curl -C --retry 10 "https://example.aliyundoc.com/examplebackup.qp.xb" -o backup.qp.xb > /tmp/download.log &
The following information provides the meanings of the options in the preceding command:
--retry 10: enables up to 10 retries if the download fails. 
-C -: enables resumable uploads. 
-o: specifies the save path and name of the backup file that you want to download. 
nohup: prevents interruptions to the download and specifies that the process automatically exits after the download is complete. If you accidentally replicate data or disconnect your database client during the download, the download is interrupted.

References