📖 Scenario: You manage a DynamoDB table that stores customer orders for an online store. To protect data, you want to create on-demand backups of this table.
🎯 Goal: Build a simple script to create an on-demand backup of a DynamoDB table named Orders.
📋 What You'll Learn
Create a variable called table_name with the value 'Orders'.
Create a variable called backup_name with the value 'OrdersBackup'.
Use the AWS SDK DynamoDB client to call the create_backup method with TableName and BackupName parameters.
Store the response of the backup creation in a variable called backup_response.
💡 Why This Matters
🌍 Real World
On-demand backups help protect important data in DynamoDB tables by creating snapshots that can be restored later if needed.
💼 Career
Database administrators and cloud engineers often create backups to ensure data safety and meet compliance requirements.
Progress0 / 4 steps
1
Set up table name variable
Create a variable called table_name and set it to the string 'Orders'.
DynamoDB
Hint
Use simple assignment: table_name = 'Orders'
2
Set up backup name variable
Create a variable called backup_name and set it to the string 'OrdersBackup'.
DynamoDB
Hint
Use simple assignment: backup_name = 'OrdersBackup'
3
Create DynamoDB client and call create_backup
Import boto3, create a DynamoDB client called dynamodb_client, and call dynamodb_client.create_backup with parameters TableName=table_name and BackupName=backup_name. Store the result in a variable called backup_response.
DynamoDB
Hint
Use boto3.client('dynamodb') to create the client and call create_backup with the correct parameters.
4
Complete backup script
Ensure the script has all previous code lines combined: import boto3, define table_name and backup_name, create dynamodb_client, and call create_backup storing the response in backup_response.
DynamoDB
Hint
Make sure all parts are included exactly as before to complete the backup script.
Practice
(1/5)
1. What is the main purpose of on-demand backups in DynamoDB?
easy
A. To delete old data from the table
B. To automatically scale the table capacity
C. To encrypt data during transfer
D. To save a copy of your table data at any time for recovery
Solution
Step 1: Understand what on-demand backups do
On-demand backups let you save your DynamoDB table data whenever you want.
Step 2: Identify the main purpose
The main goal is to protect data and allow recovery if needed.
Final Answer:
To save a copy of your table data at any time for recovery -> Option D
Quick Check:
On-demand backups = save data anytime [OK]
Hint: Backups save data copies for recovery anytime [OK]
Common Mistakes:
Confusing backups with scaling features
Thinking backups delete data
Mixing encryption with backup purpose
2. Which AWS CLI command is used to create an on-demand backup of a DynamoDB table?
easy
A. aws dynamodb backup-table
B. aws dynamodb start-backup
C. aws dynamodb create-backup
D. aws dynamodb save-backup
Solution
Step 1: Recall the correct AWS CLI command for backups
The official command to create an on-demand backup is create-backup.
Step 2: Match the command with options
Only aws dynamodb create-backup matches the exact AWS CLI syntax.
Final Answer:
aws dynamodb create-backup -> Option C
Quick Check:
Command to create backup = create-backup [OK]
Hint: Remember 'create-backup' for making backups [OK]
Common Mistakes:
Using incorrect command names like start-backup
Confusing backup commands with table creation
Adding extra words not in AWS CLI syntax
3. What will happen if you run this AWS CLI command?
The correct command to create a backup is create-backup with table and backup names.
Step 2: Identify correct restore command
To restore, use restore-table-from-backup with target table name and backup ARN.
Step 3: Verify options
Only aws dynamodb create-backup --table-name Products --backup-name ProdBackup1 aws dynamodb restore-table-from-backup --target-table-name ProductsRestored --backup-arn uses the correct commands and parameters for both backup and restore.
Final Answer:
Use create-backup then restore-table-from-backup with backup ARN -> Option A
Quick Check:
Backup with create-backup, restore with restore-table-from-backup [OK]
Hint: Backup with create-backup, restore with restore-table-from-backup [OK]
Common Mistakes:
Using wrong commands like start-backup or backup-table
Missing backup ARN in restore command
Confusing restore parameters
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.