- create a backup of the old table
aws dynamodb create-backup --table-name <old-table-name> --backup-name <some-backup-name>
and remember the arn of the backup -> BACKUP_ARN
- deploy the cdk app with the new target table. This table will be empty.
cdk deploy
- get the table name of the target table -> TARGET_TABLE
- delete the target table
aws dynamodb delete-table --table-name <TARGET_TABLE>
- restore the table backup
aws dynamodb restore-table-from-backup \
--target-table-name <TARGET_TABLE> \
--backup-arn <BACKUP_ARN>
- wait until database is restored
- (optional) run cloudformation drift detection or
cdk diff
to make sure everythin is up-to-data
Works like a charm, thank you very much! ⭐