Search code examples
amazon-web-servicescassandradisaster-recoveryamazon-keyspaces

How to export AWS Keyspaces tables from one AWS account to another in a different AWS region?


As cross-account, cross region replication is not yet available for AWS Keyspaces, what can we do to kinda support this usecase?

I am thinking about either using an active-active topology between 2 regions / 2 accounts fed by a single stream, but it implies lots of infra changes as well it would increase possible ops cost.

A one shot thing would be to generate table dump through cqlsh in S3 and import them on a brand new AWS Keyspaces.

Anyone has already done this kind of operation on AWS Keyspaces?


Solution

  • Keyspaces now supports multi-region replication for active active topologies. Create a multi region keyspaces using the following example

     CREATE  KEYSPACE IF NOT EXISTS aws_global
    WITH REPLICATION = {'class' : 'NetworkTopologyStrategy',
                        'us-east-2' : 3 , 'us-west-2' : 3 }
    AND TAGS = {'blog':'keyspaces', 'launch':'multi-Region'};
    

    For import and export, My favorite approach is to use AWS Glue and the Spark Cassandra connector. You can find scripts for import and export here. Using Glue you export to S3, replicate the bucket to another region and perform import from s3.