Skip to content

How to sync data from an RDS PostgreSQL database to Supabase with Glue?

0

Hi there!

We want to set up a mechanism to copy the new data added to an RDS PostgreSQL database to a Supabase (either self-hosted in EC2 or cloud-hosted from Supabase) database and vice-versa.

I tried to create a JDBC connection to our Supabase in Glue, but the test connection failed with the following error.

InvalidInputException: Unable to resolve any valid connection

Our idea is to create a connection to our RDS database, which was successful, and then create a crawler to add the tables. We will create an ETL job with the source as RDS and the target as Supabase to transfer the data from the Data Catalog.

For a proof of concept, we have two sample tables in our RDS database, which we would like to copy to the Supabase with the help of Glue. How can we achieve this with the available resources?

Is a connection required for the Supabase? If so, how do we resolve it? There are no CloudWatch logs for details about the error.

1 Answer
0

To sync data from an RDS PostgreSQL database to Supabase using AWS Glue, you'll need to adjust your approach slightly. While AWS Glue supports various database connections, including PostgreSQL, it doesn't have native support for Supabase. However, since Supabase is built on top of PostgreSQL, you can treat it as a PostgreSQL database for this purpose.

Here's a step-by-step approach to achieve your goal:

  1. RDS PostgreSQL Connection: You've already successfully created a connection to your RDS PostgreSQL database in AWS Glue. This is the correct first step.

  2. Supabase Connection: For Supabase, you'll need to create another JDBC connection in AWS Glue. Treat it as a PostgreSQL database. Use the following details:

    • Connection Type: JDBC
    • JDBC URL: Use your Supabase PostgreSQL connection string (usually starts with postgresql://)
    • Username and Password: Use your Supabase database credentials
    • VPC, Subnet, and Security Group: Configure these to allow access to Supabase (if self-hosted on EC2, use the appropriate VPC settings; if cloud-hosted, you may need to configure network access)
  3. Crawlers: Create a crawler for your RDS PostgreSQL database to catalog the tables you want to sync. This will add the table metadata to the AWS Glue Data Catalog.

  4. ETL Job: Create an ETL job in AWS Glue Studio with the following configuration:

    • Source: Use the RDS PostgreSQL connection and select the tables you want to sync
    • Target: Use the Supabase JDBC connection you created
    • Transformation: You can add any necessary transformations between the source and target
  5. Job Scheduling: Set up a schedule for your ETL job to run periodically to keep the data in sync.

For bidirectional sync (Supabase to RDS), you'd need to create a separate ETL job with Supabase as the source and RDS as the target.

Regarding the connection error you encountered, it could be due to several reasons:

  • Incorrect connection details (URL, username, password)
  • Network connectivity issues (VPC configuration, security groups, firewalls)
  • Supabase-specific configurations that may not be compatible with standard JDBC connections

To troubleshoot:

  1. Double-check all connection parameters
  2. Ensure your Glue job has network access to Supabase
  3. Try using a custom JDBC driver if the standard PostgreSQL driver doesn't work
  4. If using cloud-hosted Supabase, check if there are any specific connection requirements or limitations

If you continue to face issues, you might need to consider alternative approaches, such as using AWS Lambda or EC2 instances to run custom scripts for data synchronization between RDS and Supabase.
Sources
Using custom connectors and connections with AWS Glue Studio - AWS Glue
Copy and mask PII between Amazon RDS databases using visual ETL jobs in AWS Glue Studio | AWS Big Data Blog
Available connections - AWS Glue
JDBC connections - AWS Glue

answered 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.