#What holds the data
| Data | Where | Backed up by | If lost |
|---|---|---|---|
| Content: drafts, versions, the published snapshot, people, jobs, build history, encrypted Google secrets | RDS PostgreSQL, database kims |
RDS automated backups (14 days, point-in-time) and manual snapshots | Restore RDS |
| The media library: every uploaded file and its sizes | S3 assets bucket | Bucket versioning (the only copy of each upload) | Restore older object versions |
| The public website | S3 website bucket, behind CloudFront | Nothing needed: it is rebuilt from the database | Rebuild the live version |
| The key that decrypts stored Google secrets | Kubernetes Secret kims-app, key secrets-key |
KIMS's secret store (a copy kept when it was created) | Enter the Google secrets again in the CMS |
Sign-in accounts and the cms-access role |
KIMS's Keycloak | KIMS | KIMS restores Keycloak |
| Jenkins jobs and credentials | KIMS's Jenkins (folders kims-production, kims-uat) |
KIMS's Jenkins backups | Set up again: Jenkins credentials |
| Code and Helm values | KIMS's Git; the values file in the kims-helm-values credential |
Git; keep the filled-in values file in KIMS's secret store | Push again, recreate the credential |
Everything below uses production's names (kims-prod, namespace kims, folder kims-production). For UAT use kims-uat.
#RDS: what is set up
From the RDS set-up (RDS PostgreSQL):
- Backup retention 14 days. This is what turns on point-in-time recovery: RDS can restore to any second in those 14 days (up to about the last 5 minutes).
- Deletion protection on for production.
- Multi-AZ for production, so a failed instance fails over by itself; that is availability, not a backup.
- The password is self-managed, not rotated by Secrets Manager: the CMS reads it from the
kims-databaseSecret, and a silent rotation would break it.
Check retention from a workstation with the AWS CLI (any shell):
aws rds describe-db-instances --db-instance-identifier kims-prod --region <AWS_REGION> --query "DBInstances[0].[BackupRetentionPeriod,DeletionProtection,LatestRestorableTime]"You should see 14, true and a time a few minutes ago.
#Take a snapshot before a risky change
Before a release with new migrations, a bulk content change, or a database restore, take a manual snapshot. Manual snapshots are kept until deleted, beyond the 14 days.
aws rds create-db-snapshot --db-instance-identifier kims-prod --db-snapshot-identifier kims-prod-before-<SHORT_NAME> --region <AWS_REGION>
aws rds wait db-snapshot-available --db-snapshot-identifier kims-prod-before-<SHORT_NAME> --region <AWS_REGION>The same in PowerShell. It takes a few minutes for a database this size (about 13,000 rows on day one). In the console: RDS, Databases, kims-prod, Actions, Take snapshot.
Whether you may run these depends on the access KIMS gives you (AWS access); if not, ask KIMS's team to take it.
#Restore the database
A restore never overwrites the running instance: RDS always makes a new instance. Then the CMS is pointed at it.
#1. Stop changes
Ask editors to stop. Pause the scheduled tasks and the worker so nothing writes while you switch:
kubectl -n kims scale deployment/kims-worker --replicas=0
kubectl -n kims patch cronjob kims-cron-scheduled-publish-tick -p "{\"spec\":{\"suspend\":true}}"(Windows PowerShell 5.1: -p '{\"spec\":{\"suspend\":true}}'.) The next kims-platform run sets both back from the values file.
#2. Restore to a new instance
To a point in time, in the console: RDS, Databases, kims-prod, Actions, Restore to point in time. Or from a snapshot: Snapshots, the snapshot, Actions, Restore snapshot. Use a new identifier, for example kims-prod-restored, and set the same as the original:
- instance class and Multi-AZ
- the same DB subnet group (the cluster's private subnets) and the
kims-dbsecurity group (the restore picks the default group unless you change it, and the pods then can't connect) - the same parameter group, encryption on, deletion protection on
From the CLI:
aws rds restore-db-instance-to-point-in-time --source-db-instance-identifier kims-prod --target-db-instance-identifier kims-prod-restored --restore-time <UTC_TIME_LIKE_2026-12-01T09:30:00Z> --db-subnet-group-name <DB_SUBNET_GROUP> --vpc-security-group-ids <KIMS_DB_SECURITY_GROUP_ID> --region <AWS_REGION>
aws rds wait db-instance-available --db-instance-identifier kims-prod-restored --region <AWS_REGION>It takes 15 to 30 minutes. The restored instance has the same master user and password as at that time.
#3. Point the CMS at it
The connection string is the same except the host, which is the new instance's endpoint (postgres://kims:<DB_PASSWORD>@<RESTORED_ENDPOINT>:5432/kims?sslmode=require). Replace the Secret, from <KIMS_FOLDER>:
export KIMS_DATABASE_URL='<NEW_CONNECTION_STRING>' # or leave it unset and type it at the hidden prompt
node deployment-steps/scripts/deploy.mjs kims secrets create --context <KIMS_EKS_CONTEXT> --replace kims-database
unset KIMS_DATABASE_URLexport KIMS_DATABASE_URL='<NEW_CONNECTION_STRING>' # or leave it unset and type it at the hidden prompt
node deployment-steps/scripts/deploy.mjs kims secrets create --context <KIMS_EKS_CONTEXT> --replace kims-database
unset KIMS_DATABASE_URL# Leave KIMS_DATABASE_URL unset and type the string at the hidden prompt
node deployment-steps/scripts/deploy.mjs kims secrets create --context <KIMS_EKS_CONTEXT> --replace kims-databaseTyping it at the prompt keeps it out of your shell history; prefer that. It ends OK: kims-database done. Left alone: ... and reminds you to restart.
Then, in Jenkins, folder kims-production, Credentials: update kims-database-url to the same string. The site build reads the database through it; if it is left pointing at the old instance, builds export the old content.
#4. Restart and check
kubectl -n kims rollout restart deployment/kims-cms
kubectl -n kims scale deployment/kims-worker --replicas=1Then run kims-platform once, which also puts the CronJobs and worker count back from the values file, and check:
node deployment-steps/scripts/deploy.mjs kims check --context <KIMS_EKS_CONTEXT>The migrate hook applies any migrations newer than the restored point. Don't change kims-app: the restored secrets table was encrypted with the same secrets-key, so the Google secrets still work.
#5. Make the website match
The website bucket may now show content newer than the restored database. Rebuild the version that is live in the restored database (Roll back the website): run kims-site-build with PUBLISH_VERSION = the newest succeeded version in site_builds, CAUSE rebuild.
#6. Tidy up
When the restored instance has run for a while, the old one can be deleted by KIMS (turn off its deletion protection first, and keep a final snapshot). Optionally rename: RDS can rename kims-prod-restored to kims-prod once the old one is gone, which changes the endpoint again; if you do, repeat step 3.
#The assets bucket
Versioning is on, so a deleted or overwritten upload can be brought back. A delete in the Media library writes a delete marker; removing the marker restores the object.
List the versions of one file (the key is shown on the media item, or in media_assets):
aws s3api list-object-versions --bucket <ASSETS_BUCKET> --prefix <OBJECT_KEY> --region <AWS_REGION>Remove a delete marker (its VersionId is under DeleteMarkers in the output):
aws s3api delete-object --bucket <ASSETS_BUCKET> --key <OBJECT_KEY> --version-id <DELETE_MARKER_VERSION_ID> --region <AWS_REGION>Or put back an older version by copying it over the current one:
aws s3api copy-object --bucket <ASSETS_BUCKET> --key <OBJECT_KEY> --copy-source "<ASSETS_BUCKET>/<OBJECT_KEY>?versionId=<OLD_VERSION_ID>" --region <AWS_REGION>All three work the same in PowerShell. They need permissions on the bucket that the pods' role has but people usually don't; ask KIMS if refused.
After a database restore, files uploaded after the restore point stay in the bucket without a row pointing at them; that is harmless. Files deleted after the restore point are referenced by the restored rows but gone: restore them by removing their delete markers.
A lifecycle rule that expires old noncurrent versions (for example after 90 days) keeps the bucket from growing forever; it is KIMS's decision and is not set by the runbook.
#The website bucket
Nothing to back up: every site build rewrites it from the database and the assets bucket. If it is emptied or damaged, rebuild the live version as in step 5 above. A full three-language build takes about 15 minutes.
#The kims-app Secret
kims secrets create generates session-secret and secrets-key once, and nobody needs to know them. But secrets-key decrypts the Google translation key and the Google reviews sign-in stored in the database. If the namespace is deleted, or the Secret is replaced, those two must be entered again by an Admin in the CMS (Translation screen, Google reviews screen). Content is not affected.
If KIMS wants to avoid that, they keep a copy of the kims-app Secret in their own secret store when the environment is created. Never in Git, a ticket or chat.
#Back up the local database
For your own machine, before an experiment. pg_dump runs inside the Postgres container and the file is copied out, which avoids PowerShell changing binary output. Run from the repo (<KIMS_FOLDER>/repos/kims-v2); the commands are the same in all three shells:
docker compose -f local/docker-compose.yml exec -T postgres pg_dump -U kims -d kims -Fc -f /tmp/kims.dump
docker compose -f local/docker-compose.yml cp postgres:/tmp/kims.dump ../../kims-backup.dumpThe file is <KIMS_FOLDER>/kims-backup.dump. To restore it into a fresh database kims_restored (then point DATABASE_URL in .env.local at it, or drop kims and restore into that name with the apps stopped):
docker compose -f local/docker-compose.yml cp ../../kims-backup.dump postgres:/tmp/kims.dump
docker compose -f local/docker-compose.yml exec -T postgres psql -U kims -d postgres -c "create database kims_restored"
docker compose -f local/docker-compose.yml exec -T postgres pg_restore -U kims -d kims_restored --no-owner /tmp/kims.dumpThe local S3 stand-in's files are in the Docker volume kims-v2_s3-data; a local reset deletes them, and local up loads them from the bundle again (Stop and reset).
#A portable copy of the content: the data bundle
The repo's scripts/handover/data-bundle.mjs export --out <DIR> writes the content and the media library as files with checksums: the same format as the handover bundle. It reads DATABASE_URL, ASSETS_BUCKET and the S3 settings. It does not carry people, jobs, site builds or stored secrets, and it is not a replacement for RDS backups. It is how content moves to a new, empty environment (load refuses a database that already has content).
On KIMS, the database and bucket are reachable only from inside their network, so an export would run in a one-off pod like the load pod (the image's entrypoint runs kims-entrypoint data-bundle export --out <DIR>) and be copied out with kubectl cp. This has not been tried on KIMS's cluster.
#Sources
kims-v2/docs/ON-SITE-DEPLOYMENT.md(AWS set-up B and D, Things to tell KIMS, If something goes wrong),kims-v2/scripts/handover/data-bundle.mjs,kims-v2/deploy/entrypoint.sh,kims-v2/db/migrations/0301_secrets.sql,kims-v2/docs/CONFIG.md(SECRETS_KEY) (branchmain)scripts/commands/kims/secrets-create.mjs;kims/03-database.md,kims/05-kubernetes.md,kims/11-google-services.md- RDS automated backups: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html
- RDS point-in-time restore: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIT.html
- RDS manual snapshots: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateSnapshot.html
aws rds restore-db-instance-to-point-in-time: https://docs.aws.amazon.com/cli/latest/reference/rds/restore-db-instance-to-point-in-time.html- S3 versioning, restoring previous versions: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RestoringPreviousVersions.html
pg_dump: https://www.postgresql.org/docs/current/app-pgdump.htmlpg_restore: https://www.postgresql.org/docs/current/app-pgrestore.html