Home > Net >  Amazon DynamoDB modify structure using serverless
Amazon DynamoDB modify structure using serverless

Time:10-26

What is the best way to modify a DynamoDB table structure (no problems on erasing it because of backup)? I have a table with only HASH KEY. I have to add a SORT KEY for the table.

When I deploy the stack I receive this error

Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [DynamoDBTransactionsFinished] in the Resources block of the template

Some way to solve it?

CodePudding user response:

Here is what I what do. You have references in your template to the DynamoDB table that will fail if you simply delete the DynamoDB table resource from your template, so I would:

  1. add a secondary table that matches the first, re-point all references from the 1st table to the 2nd table
  2. delete the first table
  3. re-deploy your stack
  4. modify the template again to re-add the first table, but this time with the additional sort key
  5. re-point the references to the new 1st table
  6. delete the 2nd table
  7. re-deploy the stack
  • Related