RDS Restore from Snapshot

You want to put an RDS database back to the state captured in a snapshot — for
example after a failed migration. The platform provides an automated restore for
AWS environments: a Lambda function deployed into your own environment performs
the restore, so you do not need infrastructure-level access to run it.

The function is idempotent. If it exceeds the 15-minute Lambda timeout, invoke it
again and it continues from where it stopped.

ℹ️

Do not run a self-service restore against a production database. For
production recovery, raise a request immediately and we will run it with you. A
restore replaces the contents of the target database.

When to use this

  • Returning a dev or staging database to a known-good state after a failed
    migration.
  • Recovering from accidental data deletion in a non-production environment.
  • Testing your application against a production data snapshot in a lower
    environment.

Before you start

  • AWS Console access to your own account, with permission to view Lambda
    and CloudWatch. You need it to invoke the function and to watch the
    progress. If your team does not have Console access, raise a request and CTO2B
    will run the restore for you instead — the rest of this article is then not
    needed.
  • The rds-autorestore image present in your AWS ECR registry. If it is not
    there, raise a request and CTO2B will push it.
  • The snapshot identifier you want to restore from, found in the AWS Console
    under RDS → Snapshots, or by asking in your Slack channel.

Step 1 — deploy the restore Lambda

  1. In SVIEW, open the Service where the restore should run.
  2. Add a Component from the Catalog and select RDS Automatic Restore Lambda.
  3. Configure the required values:
image_uri: <your-account-id>.dkr.ecr.<region>.amazonaws.com/rds-autorestore:<tag>

environment_variables:
  SOURCE_DB: "<name-of-the-source-rds-instance>"
  SNAPSHOT_ID: "<snapshot-identifier>"

Use the newest rds-autorestore tag present in your ECR repository — check the
repository in the AWS Console, or ask in your Slack channel if you are unsure
which tag to use.

  1. Click Save and wait for the Component to reach a healthy status.

Step 2 — invoke the Lambda

  1. In the AWS Console, go to Lambda → Functions.
  2. Find the function matching your Component name.
  3. Click Test. The event JSON is ignored.
  4. Click Test again to invoke it.

Follow progress in CloudWatch → Log Groups, searching for the Lambda function
name. A restore usually takes 10 to 30 minutes depending on database size.

Step 3 — update the database revision

Once the restore completes, increment the rev field in the database
Component's configuration so the platform state reflects the new instance:

terraform:
  spec:
    variables:
      rev: 6    # increment each time you restore

Click Save.

Verify it worked

Check that the database Component returns to a healthy status in SVIEW, that
your application reconnects, and that the restored data matches the point in time
you expected.

Common issues

IssueWhat to check
The Component will not startThe image_uri tag does not exist in your registry. Confirm the tag in ECR.
The Lambda stops after 15 minutesExpected on larger databases. Invoke it again; it resumes.
The snapshot is not listedIt may be outside the retention window. See RDS Backup Retention.
The application still sees old dataThe rev field was not incremented, or the application is holding stale connections.

If the issue persists, raise a request with the database name, the snapshot
identifier, and the CloudWatch log output.

Related articles


Did this page help you?