Migrate from AWS RDS to Xata

Learn how to migrate your AWS RDS PostgreSQL database to Xata using xata clone. Step-by-step instructions for secure migration from RDS.

Prerequisites

  • AWS RDS PostgreSQL instance
  • Access to AWS Console
  • Xata account and project setup
  • Network access to your RDS instance

Install and Configure the Xata CLI

Install the Xata CLI:

curl -fsSL https://xata.io/install.sh | bash

Authenticate with your Xata account:

xata auth login

Network Configuration

Option 1: Public Endpoint (Less Secure)

If your RDS instance has a public endpoint:

  1. Whitelist Your IP:
    • Go to your RDS instance → Security Groups
    • Add a rule allowing PostgreSQL (port 5432) from your IP address
    • Or temporarily allow from anywhere (0.0.0.0/0) for migration

For better security, run the migration from within AWS:

  1. EC2 Instance in Same VPC:

    • Launch an EC2 instance in the same VPC as your RDS
    • Install Xata CLI on the EC2 instance
    • Run the migration from there
  2. GitHub Actions with AWS Credentials:

    • Use GitHub Actions with AWS credentials
    • Configure the action to run in your VPC
    • Use the private endpoint for connection

Get Connection String

postgresql://your_username:your_password@your-rds-endpoint:5432/your_database

You can find the endpoint in the AWS RDS Console under your instance details.

Initialize Xata Project

Set up your Xata project configuration:

xata init

Configure the Migration

Set up your clone configuration with optional anonymization:

# Set your source URL
export XATA_CLI_SOURCE_POSTGRES_URL="postgresql://your_username:your_password@your-rds-endpoint:5432/your_database"

# Configure anonymization rules
xata clone config --source-url $XATA_CLI_SOURCE_POSTGRES_URL --mode prompt

Start the Migration

Begin the data transfer:

# Start the migration
xata clone start --source-url $XATA_CLI_SOURCE_POSTGRES_URL

Monitor Progress

Check the migration status:

xata clone status

Verification

After migration, verify your data:

  1. Connect to Xata Branch:

    psql `xata branch url`
  2. Check Data Integrity:

    -- Compare row counts
    SELECT COUNT(*) FROM your_table;
    
    -- Check sample data
    SELECT * FROM your_table LIMIT 10;
  3. Test Relationships: Verify foreign key relationships work correctly

Next Steps