Skip to main content

How to Restore a Location from Backup

This guide provides a straightforward process for restoring a location from a database snapshot backup using AWS CDK. Make sure to verify the snapshot ARN or ID and handle the fromSnapshotId property carefully to ensure a smooth restoration process.

Steps

Find a Database Snapshot

Identify the database snapshot you want to restore. This could be an ARN (Amazon Resource Name) or an ID of the snapshot.

Set the fromSnapshotId property

In your aurora location definition, set the fromSnapshotId property to the ARN or ID of the snapshot you found.

const props : AuroraLocationClusterProps = ...

const auroraCluster = depot.Location.Aurora.withCluster(this, id, {
...props,
fromSnapshotId: 'snap-2'
// or
// fromSnapshotId: 'arn:aws:rds:eu-west-1:654409816600:cluster-snapshot:snap-2'
});

Deploy your CDK stack

Deploy the changes using the AWS CDK (Cloud Development Kit) by running:

cdk deploy

Possible Questions

What if the backup snapshot will get deleted later?

It doesn't matter as the new location has already been created.

What if someone removes the property fromSnapshotId later from the location definition?

A new empty cluster will be created, and the old one will be backed up before deletion, because we set: removalPolicy: RemovalPolicy.SNAPSHOT. So in the worst-case scenario, it can be recreated from the new snapshot.

So the fromSnapshotId property should be left in forever (or until the next disaster)?

Indeed, we don't need to touch fromSnapshotId until we need to restore from another backup again.