I want to enable a PITR (Point-in-time recovery) for my DynamoDB tables. After the recovery, a new table is created, with a table name you specify.
In such scenario, I need to change my backend to start using these newly recovered tables. That includes changing my serverless.yml config file.
I have this table specification:
Role:
Type: AWS::DynamoDB::Table
Properties:
TableName: Role
KeySchema:
- AttributeName: id
KeyType: HASH
GlobalSecondaryIndexes:
- ...
AttributeDefinitions:
- ...
BillingMode: PAY_PER_REQUEST
If I recover such table into let’s say RoleRecovered
, I thought I could just change the TableName in the config file to RoleRecovered
and I will be able to work with this table. But instead, I get an error:
Resource of type 'AWS::DynamoDB::Table' with identifier 'RoleRecovered' already exists.
Can I somehow tell serverless that this table has been created outside of it (by the AWS DynamoDB PITR) and it should therefore not try to create it again? Or is there another solution to handle the PITR? I know I could just create new tables with serverless and then import data from the recovered tables to them, but that would be a lot of backing up/restoring and would probably take days in case of recovering the whole database.