Hossein Jamshidi
Hossein Jamshidi

Reputation: 5

How to restore a backup table in DynamoDB programmatically? (using C#)

I intended to duplicate a DynamoDB table programmatically. I didn't find any query for that, apart from scanning the table and saving it to the new table, but because the table is big, it takes an unreasonable amount of time to achieve that. So, I thought that one alternative way to do it should be backing up the table and then restoring it into a new table. However, I don't find anything for doing it in c#.

I appreciate your help.

Upvotes: 0

Views: 235

Answers (1)

Jason Wadsworth
Jason Wadsworth

Reputation: 8885

You can use the DynamoDB backup/restore.

var backupResponse = await dynamoDbClient.CreateBackupAsync(new CreateBackupRequest
{
    BackupName = backupName,
    TableName = orginalTable
};
await dynamoDbClient.RestoreTableFromBackupAsync(new RestoreTableFromBackupRequest
{
    BackupArn = backupResponse.BackupDetails.BackupArn,
    TargetTableName = newTableName
};

Upvotes: 1

Related Questions