LightSail Emergency restore does not work

1

I have an active PostgreSQL db in LightSail. I have found that I should be able to copy it to new database to have a consistent database for use in a different ENV. I have followed the steps to restore snapshot to new database. It ended up in alert: CreateRelationalDatabaseFromSnapshot[eu-central-1] The restoreTime must be on or before the latestRestorableTime for the specified source database. InvalidParams

While the time is 10 minutes or even 1 day before the time now.

I tried it once again, and it ends up in a different error now: CreateRelationalDatabaseFromSnapshot[eu-central-1] Some names are already in use: (NEW NAME I HAVE USED FOR DB) NameExists

And I do not see the db in a list of my dbs even after 2 hours of waiting.

Have someone seen the same issue before? And what could we do to copy DB using LightSail services? We have also tried manual snapshot, and then create new from snapshot - it does not work. Error is the same.

asked a year ago179 views
1 Answer
0

I have repeated the steps you describe in your question for creating a new DB from the point-in-time restore. It seems as though the web site is defaulting to a time that is not yet valid. I have reported this as a defect to our development team.

To work around it, please choose a time that is earlier than the latestRestorableTime reported by GetRelationalDatabase for your db instance. If you have the AWS CLI installed you can get that information by using the following command:

aws lightsail get-relational-database --relational-database-name <name of your original database>

It will output something similar to this:

{
    "relationalDatabase": {
        "name": "foo",
        "arn": "REDACTED",
        "supportCode": "REDACTED",
        "createdAt": "2022-11-03T11:21:09.771000-07:00",
        ... omitted for brevity.
        "latestRestorableTime": "2022-11-03T11:54:30-07:00", <--- This is the latest time you can restore from.
        ... omitted for brevity.
    }
}

You should select the closest time to, but before the time reported there.

If you need more precision you can use the aws cli to restore from the latest restorable time automatically:

aws lightsail create-relational-database-from-snapshot --relational-database-name foo-restore --source-relational-database-name foo --use-latest-restorable-time

Where "foo" is the name of the original database and "foo-restore" is the name of the new database.

If you need to restore from a specific time that is not the latest you can use the --restoreTime parameter instead of --use-latest-restorable-time. Please consult the CLI reference for details: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lightsail/create-relational-database-from-snapshot.html

Note that in all example command lines above I have omitted authentication parameters because I have a default profile setup for my account. You can consult the CLI user guide for details on how to authenticate via the CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html

Regarding the second issue you described where you are getting a naming conflict: please be aware that resource names in Lightsail must be regionally unique across all resource types. This means that if you have any resource, not just a database, with that name you will receive the "Some names are already in use" error message.

I hope this helps!

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions