Want to Migrate DynamoDB Tables from one AWS account to another? We can help you.
Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.
Today, let us see how we can perform this.
Migrate DynamoDB Tables from one AWS account to another
We can migrate the DynamoDB tables to a different AWS account by doing the following:
- Export the DynamoDB table data into an Amazon S3 bucket in the other account.
- Use an AWS Glue job to import the data.
In addition, we can use the AWS Data Pipeline or Amazon EMR to move DynamoDB tables to another AWS account.
Amazon S3 and AWS Glue
It is possible to migrate the DynamoDB table to a different AWS account using an Amazon S3 bucket and an AWS Glue job.
1. For the initial migration of the DynamoDB table we export the tables to an Amazon S3 bucket in the other account.
When you export your tables from Account A to an S3 bucket in Account B, the objects are still owned by Account A.
To solve this, we include the PutObjectAcl permission on all exported objects once the export is complete.
2. We use a Glue job to read the files from the S3 bucket and write them to the target DynamoDB table.
3. Once we export the tables, we use DynamoDB streams and AWS Lambda to migrate the data insertions and updates in the source table to the destination table in another account.
With Amazon EMR, we have two options, depending on the use case:
1. If we can afford downtime during the migration, then we stop write operations to the source table.
This is to assure that the target table is in sync with the source table.
2. If we can’t afford downtime, then we store all transactions that happen during the migration in a staging table.
Once the migration is done, we push the new transactions from the staging table to the target table.
To migrate a DynamoDB table using Amazon EMR:
- In both source and destination accounts, we launch EMR clusters. In the Software configuration section, we need to include Apache Hive.
- The EMR_EC2_DefaultRole IAM roles in both accounts should have permission to write to the S3 bucket in the destination account.
- In the source account, we connect to the master node via SSH.
- Then, we use Hive commands to export data to the S3 bucket in the destination account.
- In there, we import the Amazon S3 data to the new DynamoDB table.
[Stuck with the procedures? We’d be happy to assist]
In short, we saw how our Support Techs go about the migration of DynamoDB Tables from one AWS account to another.