Backup and recovery
In the case of an emergency, restore your databases
Read time 1 minuteLast updated 9 months ago
These best practices are critical for any system:
- Store backups
- Set up a recovery plan
The solution backs up several components that you can restore in the case of an emergency.
Restore the Keycloak database
Keycloak persists the following data in Amazon Relational Database Service (RDS) Postgres:
- Users
- Roles
- Sessions
- Events
To restore the Keycloak database instance to a specific point in time, complete these steps:
-
Go to the Amazon RDS console and complete these steps:
-
Go to Automated Backups.
-
Select the Keycloak database instance, and then select Actions > Restore to point in time.
-
Specify the recovery parameters:
- Select the desired time.
- Enter a database instance modifier, for example, .
asset-solutions-postgres-restored
-
Select Restore to point in time.
-
-
In the console application, complete these steps:
-
To remove the current RDS instance from the Terraform state, run the following command within thedirectory:
aws/terraform/terraform state rm aws_db_instance.asset-solutions-postgres -
To import the newly restored RDS instance, run this command:terraform import -var-file tfvars/us-east-1.tfvars aws_db_instance.asset-solutions-postgres asset-solutions-postgres-restored
-
Optionally, to avoid a naming conflict, rename the database in thefile or remove the old instance
postgres.tf.asset-solutions-postgres -
To apply the Terraform plan, run this command:
make apply -
Restore MongoDB
To restore MongoDB, refer to the appropriate documentation based on your deployment:
- If using a MongoDB VM, refer to the MongoDB Atlas documentation.
- If using PSMDB, refer to the Percona Server for MongoDB documentation.