Reputation: 448
I have a couple of CloudFormation Stacks made from the same template that contain a few DynamoDB tables each. I recently needed to make a change to the LSI's of a DynamoDB table. When Updating Stack for the stack environments that do not have any data in their DB's yet this is fine, but when I get round to updating our shared dev Stack I will have a problem. LSI's can only be created at table creation, so when a Stack changes the LSI's it has to delete and create completely new resources which will drop all data currently in the table.
Our shared dev environment already contains some data for demo's and testing and I'd rather not have to interrupt that. Is there any way that I can copy data from different versions of the databases while I Update Stack? I don't mind a somewhat manual process, like exporting all of the data and importing after the update, but theres too much data to manually input each item. It's not the end of the world if I have to wipe the data, just wondering if there is any work around.
Upvotes: 5
Views: 3650
Reputation: 5659
CloudFormation will not take care of this automatically- it just manages AWS resources, not the data in them.
However, there are solutions that allow you to export data from DynamoDB to S3 and import it back. For example, the following two links show how to do that using AWS Data Pipelines:
Upvotes: 4
Reputation: 39226
The DynamoDB import/export functionality can be used from Management console to achieve this.
The DynamoDB import/export functionality uses AWS Data Pipeline and EMR clusters to move the data from DynamoDB to S3 and vice versa.
There is a default template available on AWS Data Pipeline to perform this activity.
Once you complete the operations (export / import), the resources can be released.
AWS DynamoDB Import and Export Blog
Upvotes: 4