Skip to content

Efficiently Migrating and Archiving Data from RDS Postgres to S3 in Parquet Format

0

Hello AWS Community,

I am currently storing event logs in an RDS Postgres database and am looking for an efficient way to manage the growing size of our tables. Here's what I am aiming to achieve:

  1. Data Migration and Deletion: I want to migrate data that's more than one day old from the Postgres database to S3, and store it in Parquet format. After migration, the data should be deleted from the Postgres table to prevent it from becoming too large.

  2. Use of AWS Services: While it seems feasible to use AWS Glue for a similar task, my understanding is that it requires fetching the entire table and then applying filters to replicate the data. I'm curious if there's a way to optimize this process.

  3. Looking for Managed Services: Ideally, I would like to use a managed service that can perform this operation efficiently, cost-effectively, and with minimal setup. Writing a custom batch script is an option, but I am wondering if there's an existing AWS service specifically designed for such a use case.

Could anyone advise if there is an AWS service that fits these requirements or share any best practices for handling such scenarios?

Thank you in advance for your assistance!

Best regards,

Alan.

asked 2 years ago2.6K views

1 Answer
2
Accepted Answer

Hi,

I think this blog Archive and Purge Data for Amazon RDS for PostgreSQL and Amazon Aurora with PostgreSQL Compatibility using pg_partman and Amazon S3 provides you a tested way to achieve what you are describing.

Note that the example uses CSV format, but if parquet is a hard requirement, it would be possible to either export it in parquet (you should test this) or you can convert CSV to Parquet using AWS Glue fairly easily, please refer this.

Thanks, Rama

AWS
EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

AWS
EXPERT

reviewed 2 years ago

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.