How can I restore AWS-RDS aurora database to a specified time in CLI?

883 views Asked by At

I want to restore my Aurora database to a specified time. I've enabled the automated backups. I've tried the following script from the official user guide (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIT.html):

aws rds restore-db-instance-to-point-in-time \
    --source-db-instance-identifier mysourcedbinstance \
    --target-db-instance-identifier mytargetdbinstance \
    --restore-time 2018-01-12T23:45:00.000Z

I've got the following error:

An error occurred (PointInTimeRestoreNotEnabled) when calling the RestoreDBInstanceToPointInTime operation: Point-in-time restore is not enabled for this database instance. To enable point-in-time restore, use ModifyDBInstance to set the backup retention period to a non-zero value.

The "BackupRetentionPeriod" property of the source instance is 30.

According to the AWS console, this restore time is between "Earliest restorable time" and "Latest restore time":

enter image description here

Wha am I doing wrong?

1

There are 1 answers

0
Chris Pollard On

If you look at the example from here, I think your CLI command is incorrect and the error message is just crappy. In particular, your time looks bad.

https://docs.aws.amazon.com/cli/latest/reference/rds/restore-db-instance-to-point-in-time.html

Try:

aws rds restore-db-instance-to-point-in-time \ --source-db-instance-identifier mysourcedbinstance \ --target-db-instance-identifier mytargetdbinstance \ --restore-time 2018-01-12T23:45:00Z