I have DynamoDB table and I would like to rename it. There does not seems to be any commands or options to rename a table. Has anybody renamed a table before?
It's not actually possible to rename a DynamoDB table. A common workaround is to create a new table and copy the data (it is also possible to use AWS Data Pipeline to export/import data via S3).
In an AWS account, table names must be unique within each Region. That is, you can have two tables with same name if you create the tables in different Regions. CreateTable is an asynchronous operation. Upon receiving a CreateTable request, DynamoDB immediately returns a response with a TableStatus of CREATING .
To update an existing item in an Amazon DynamoDB table, you use the UpdateItem operation. You must provide the key of the item that you want to update. You must also provide an update expression, indicating the attributes that you want to modify and the values that you want to assign to them.
I know this is an old question and I don't want to steal the thunder from user6500852's answer but for anyone stumbling upon this needing an answer:
Select the table you want to rename in the Web UI so it's highlighted and the various tabs show up to the right.
Click on the Backups tab and feast your eyes upon the lower half of the page ("On-Demand Backup and Restore").
3. Smash that "Create Backup" button. You'll be prompted for a backup name. Name it whatever you want. The world is yours!
Give it time to complete the backup. If you just have a few records, this will be seconds. If you have a ton of records it could be hours. Buckle up or just go home and get some rest.
Once the backup is ready, highlight it in the list. You'll see the "Restore Backup" button light up. Click it.
You'll get a prompt asking you to enter the NEW table name. Enter the name you wanted to rename this table to. Note: the way the UI is you may have to click out of the field in the static page area for the "Restore table" button at the bottom of the page to light up.
Bear in mind that last note! If you're working with a Global Table, you will lose the Global part after the restore. Buyer beware! You may have to consider an export and import via Data Pipeline...
If you're not, then the Backup and Restore is a pretty easy process to use (without having to go and setup a pipeline, S3 store, etc.). It can just take some time.
Hope this helps someone!
Currently no, you would need to create a new table and copy the data from one to the other if you really needed a new table name.
You can use the Export/Import feature to backup your data to S3. Then delete your old table, and create a new one with the new name. Import your data from S3. Done. No code change necessary. If you don't delete CloudWatch alarms and Pipelines when deleting the old table, then those will automatically hook up to the new table. The ARN even stays the same.
The downside to this, of course, is that the table will be unusable during the time after you delete it and before you recreate it. This may or may not be a problem, but that needs to be considered. Additionally, once you recreate the table, it can be accessed while you work on the data import. You may want to stop your app's access to the table until the import is complete.
Create first backup from backup tab. While creating restore backup, it prompt with request of new table name.
In that we can apply new/backup table name.
Hope this will help.
You should be able to achieve this using on demand backup / restore functionality.
Check out a walk through on backing up a table, and restore to a new table:
https://www.abhayachauhan.com/2017/12/dynamodb-scheduling-on-demand-backups/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With