CamHart
CamHart

Reputation: 4335

AWS Dynamodb ContinuousBackupsUnavailableException

I'm trying to backup my DynamoDB table that was originally created over a year ago using DynamoDBs new "backup" feature. However when I go to create the backup, I get the following error message:

Backups are being enabled for the table: prod-supercoolsoftware-stuff. Please
retry later (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: 
ContinuousBackupsUnavailableException; Request ID: 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)

However, when I backup a table made just yesterday on the same account in the same region, it works.

Will my table eventually be able to be backed up? Or do I need to figure out how to create a new table and migrate the data over to it (yuck!)?

Edit: backups are now enabled for my tables 12/26/17

Upvotes: 3

Views: 2443

Answers (4)

Den
Den

Reputation: 89

Just in case if someone comes here after facing this error in AWS CLI.

In bash I handled it with adding a retry loop:

function enablePointInTimeRecovery() {
    local table_name=$1
    local max_retries=10
    local retry_count=0
    local sleep_seconds=10

    echo "Enabling point-in-time recovery for table '$table_name'..."

    while [ $retry_count -lt $max_retries ]; do
        aws dynamodb update-continuous-backups \
            --table-name "$table_name" \
            --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true

        if [ $? -eq 0 ]; then
            echo "Point-in-time recovery successfully enabled for table '$table_name'."
            return 0
        else
            echo "Retry $((retry_count + 1))/$max_retries: Waiting for $sleep_seconds seconds..."
            ((retry_count++))
            sleep $sleep_seconds
        fi
    done

    echo "Failed to enable point-in-time recovery for table '$table_name' after $max_retries retries."
    return 1
}

enablePointInTimeRecovery "table-name"

Upvotes: 0

OlegMaksimovich
OlegMaksimovich

Reputation: 31

It takes time for AWS to allow you to enable Point In Time Recovery after a table is created, so our solution is to add retry logic with a delay, because it looks like expected behavior for DynamoDB.

Here is the example on Kotlin for AsyncDynamoDbClient and WebFlux:

 Mono.defer {
   client.updateContinuousBackups(updateContinuousBackupsRequest)
         .toMono()
}
 .retryBackoff(5, Duration.ofMillis(100))

Upvotes: 2

izelrea
izelrea

Reputation: 173

Enable backups on the old table and wait for them to be enabled. For new tables, backups are enabled by default.

Upvotes: 0

F_SO_K
F_SO_K

Reputation: 14799

I think its worth just waiting a while and trying again in the next few days and weeks. According to the AWS docs the exception means Backups have not yet been enabled for this table. So it sounds like an expected situation rather than a functional exception.

AWS have indicated the backup feature is being rolled out incrementally

On-Demand Backup is being rolled out to US East (N. Virginia), US East (Ohio), US West (Oregon), EU (Ireland) regions starting today, and will be completed for all tables in the coming weeks.

The above announcement is not dated but im pretty sure it was from last week (late Nov 2017).

Although the statement doesn't specify any details, it sounds like even within those regions, individual tables may get the feature at different times.

Upvotes: 1

Related Questions