Skip to content

Migrate Information From S3 to MySQL Database (previously RDS exported to S3)

0

My goal here is find a way to migrate information from my S3 Bucket to MySQL where in first place all the information of my databases MySQL was exported to S3. Initially I simply used the option from RDS from snapshot (export to S3) and it took like 20 minutes, after the information was migrated I checked the bucket and everything seemed ok. Second, I tried the RDS option called "restore from S3" where I found some issues with policies so I had to use a new role with the suggested policies. Finally when all settings were fine when I tried to restore I found that it cannot be restored because there aren't compatible files. The exported files to the bucket are many folders and files .gz.parquet, that's my current issue.

Is there any way to restore such a files? Some AWS tool or something? And finally, why Amazon doesn't give any direct solution to restore a previously exported database to S3? Thanks in advance.

1 Answer
2
Accepted Answer

Unfortunately, there isn't a direct way to restore the .gz.parquet files exported from an RDS snapshot to S3 back into a MySQL database. The RDS snapshot export to S3 feature creates files in a format that is not directly compatible with the "restore from S3" option for MySQL databases.

To migrate your data from S3 back to a MySQL database, you'll need to take a different approach:

  1. Use a tool that can read Parquet files and convert them to a format compatible with MySQL, such as CSV.

  2. Once you have the data in a compatible format (like CSV), you can use the MySQL Shell utility to load the data into your MySQL database. For example, you could use the util.loadDump utility to import data from S3 to a new MySQL instance:

    util.loadDump("your-folder", {s3BucketName: "your-bucket-name", threads: 4})

  3. Alternatively, you could use the LOAD DATA FROM S3 MySQL command to load data from text files in your S3 bucket into an existing MySQL database.

As for why Amazon doesn't provide a direct solution to restore a previously exported database from S3, it's because the snapshot export to S3 feature is primarily designed for data analysis and reporting purposes, not for database restoration. The export creates files optimized for analytics workloads, which are not directly compatible with MySQL's import processes.

For future migrations or backups where you anticipate needing to restore the data, consider using MySQL-compatible backup methods such as mysqldump or Percona XtraBackup. These tools create backups that can be easily restored to MySQL databases, including through the "restore from S3" option in RDS.

If you frequently need to move data between RDS and S3, you might want to explore using AWS Database Migration Service (DMS) or AWS Glue for more flexible data movement and transformation options.

Sources
Reduce Amazon Aurora MySQL backup costs using MySQL Shell and Amazon S3 | AWS Database Blog
Migrating a MySQL-Compatible Database to Amazon Aurora MySQL - Database Migration Guide
Restoring a backup into an Amazon RDS for MySQL DB instance - Amazon Relational Database Service
Migrating data to an Amazon Aurora MySQL DB cluster - Amazon Aurora

answered a year ago
EXPERT
reviewed a year ago
  • Ok, understood. One final question about the issue, which option mentioned before let me restore an entire RDS from my .gz.parquet files? or only can restore the databases one by one?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.