In this practice, we will take the backup of DynamoDB database using AWS CLI but we can also take the backup using AWS console.
Here, we are going to create a backup named 'students-bkp-cli' for an existing table named 'students' using AWS CLI.
Steps we need to follow:
1. Create an IAM user who will access the database
2. Download the AWS CLI MSI installer
2. Download the AWS CLI MSI installer
3. Login to AWS CLI from user 'Charlie'
4. Take backup named 'students-bkp-cli'
5. Get brief details about the backup
Step 1: Create an IAM user named 'Charlie' who will access the database:
We will create a user named 'Charlie' to access the database.
AWS ➔ Services ➔ IAM ➔ Users ➔ Add user ➔ User name: Charlie ➔ Access type: Programmatic access ➔ Next: Permission ➔ Create group ➔ Group name: DynamoDB ➔ Filter policy: DynamoDB ➔ select AmazonDynamoDBFullAccess ➔ Create Group ➔Next ➔ Review ➔ Create user ➔ Download .csv file ➔ Close.
In this file, we have an access key and a secret access key. By using these keys we can access the AWS CLI.
Step 2: Download the AWS CLI MSI installer:
To download AWS CLI use the below-mentioned link:https://docs.aws.amazon.com/cli/latest/userguide/install-windows.html
Now, install the downloaded file.
Step 3: Login to AWS CLI from user 'Charlie':
Open PowerShell ➔ use command:C:\> aws configure
C:\> AWS Access Key ID: <provide the .csv file which you downloaded>
C:\> AWS Secret Access Key ID: <provide the .csv file which you downloaded>
C:\> Default region name: us-east-1
C:\> Default output format: table
Fig: Login to AWS CLI |
Step 4: Take backup named 'students-bkp-cli':
To take backup from CLI use below-mentioned command:C:\> aws dynamodb create-backup --table-name students --backup-name students-bkp-cli
As we hit enter the backup will be created named 'students-bkp-cli' and we can verify this from AWS console also.
Fig: Take Database Backup |
Fig: Available State of Backup |
AWS ➔ Services ➔ DynamoDB ➔ Backups.
Here, we can see the backup we created named 'students-bkp-cli' from AWS CLI is listed.
Fig: Verify the Backup from AWS Console |
Step 5: Get brief details about the backup:
If we want we can get full details of our backup using its ARN number.Syntax:
C:\> aws dynamodb describe-backup --backup-arn <Backup_ARN>
Example:
C:\> aws dynamodb describe-backup --backup-arn arn:aws:dynamodb:us-east-1:401300871758:table/students/backup/01564256808673-1e23e170
|
Enjoy!
Informative blog. Thank you for sharing with us..
ReplyDeleteAWS Online Training