forked from aws-samples/aws-dynamodb-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DescribeBackup.js
27 lines (22 loc) · 917 Bytes
/
DescribeBackup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// A simple script to describe an on-demand backup of a DynamoDB table.
const { DynamoDBClient, DescribeBackupCommand } = require('@aws-sdk/client-dynamodb'); // ES Modules import
const REGION = "us-west-2";
const TableName = "<your-table-name>";
const AccountNumber = "<your-aws-account-number>";
const BackupID = "<your-backup-id>";
const BackupArn = "arn:aws:dynamodb:" + REGION + ":" + AccountNumber + ":table/"+ TableName + "/backup/" + BackupID;
async function DescribeBackup() {
const client = new DynamoDBClient({ region: REGION });
try {
return await client.send(
new DescribeBackupCommand({
BackupArn: BackupArn,
},)
);
} catch (err) {
console.error(err);
}
}
DescribeBackup()
.then((data) => console.log(data))
.catch((error) => console.log("An error occurred while describing a backup:" + ' ' + error.message ));