This topic describes how to use the get_rds_backup.py tool to download the backup file of RDS for MySQL to the local server. The time range can be customized.
Alibaba Cloud reminds you that:
- When you perform operations that have risks, such as modifying instance configurations or data, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
- Before you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
- If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.
- You must install the Python 2.7 environment and Python SDK RDS. For more information, see Python SDK for RDS usage.
- Check whether the local server can access the public IP address. If the RDS instance does not have an Internet address, see application for outer network address.
- Download the following script file to your local server.
- Run the following command to get_rds_backup.py the script.
python get_rds_backup.py [$RDS_ID] [$Access_Key_ID] [$Access_Key_Secret] [$Backup_Dir]
Note:The following command output is displayed:
- [$RDS_ID]: indicates the ID of the destination RDS instance. You can check the ID on the basic information page of the destination RDS instance. Such as "rm-hp38xxxxxx2i07".
- Access_Key_ID: specifies the accesskey ID of the RAM user. If you do not have a RAM user, you can create a RAM user.
- Access_Key_Secret: specifies the accesskey secret of the RAM user.
- Backup_Dir: specifies the directory used to store backups. Make sure that you have sufficient disk space to avoid download failures.
- By default, you can download the backup files generated in the previous day. If you want to modify the time range,
endtimethe value of the variable.
- ApsaraDB RDS for MySQL
Note: This method is only applicable to Linux, Windows, and other systems that support Python 2.7.