Can't get information about DynamoDB backups using AWS Golang SDK

Viewed 31

I need to get information about DynamoDB tables backups. So lets say I have backups listed in dashboard: enter image description here

I can't get any backups using Golang SDK though:

import (
...
"github.com/aws/aws-sdk-go/service/dynamodb"
...
)
...
svc := dynamodb.New(c.providerConfig.Session, regionConfig)
response, err := svc.ListBackupsWithContext(ctx, input)
// response.BackupSummaries is empty

backupArn := <ARN of any of the backups from dashboard>
output, _ := svc.DescribeBackupWithContext(ctx, &dynamodb.DescribeBackupInput{BackupArn: &backupArn})
// even with requesting for a backup by specific ARN we have no luck
// output.BackupDescription is nil

Other functions (1. getting tables with ListTablesPagesWithContext 2. getting continuous backup description with DescribeContinuousBackups) works perfectly. The only thing i can't get (non-continuous) backups.

Can someone help with explanation why I keep getting empty responses though DynamoDB table backups listed in dashboard?

1 Answers

The default settings for ListBackups is BackupType:USER. This means when you call ListBackups you are only being returned ones that are manually created. As your backups are maintained by AWS Backup, you should set the BackupType parameter to either ALL or SYSTEM.

Hope that helps.

Note I attempted to fix your code, but Go is not my strong point (50% chance of being correct :) )

backupArn := <ARN of any of the backups from dashboard>
backupType:= 'ALL'
output, _ := svc.DescribeBackupWithContext(ctx, &dynamodb.DescribeBackupInput{BackupArn: &backupArn, BackupType: &backupType})
Related