DEV Community

loading...

How to migrate data between AWS RDS and S3

Max Borysov
Originally published at Medium ・1 min read

If you are using AWS Aurora MySQL/Postgres or AWS Redshift you have access to S3. Therefore, it is possible to export data from RDS to S3. And you can import data back from S3 to RDS.

How to export data from RDS to S3 file:

SELECT *
FROM users
INTO OUTFILE S3 's3://some-bucket-name/users';
Enter fullscreen mode Exit fullscreen mode

This command only exports data, even without column names. No indexes or other information is present. Only data.

Import data from S3 to RDS:

LOAD DATA FROM S3 PREFIX 's3://some-bucket-name/users'
INTO TABLE users;
Enter fullscreen mode Exit fullscreen mode

For me, they are one of the most frequently used features in day-to-day tasks, like:

  • export data from RDS to S3. Import S3 file to Google Sheets to prepare some reports, build charts and share with clients or teammates
  • having data in CVS/TSV format(from a client or any other source) as a file on S3, import file to RDS, perform some operations/aggregations/etc and export data to S3 as a new report

I strongly recommend checking this feature.

Useful links:

Discussion (0)

Forem Open with the Forem app