New to Kestra?
Use blueprints to kickstart your first workflows.
Schedule pg_dump backups to AWS S3, test-restore into an ephemeral database to verify schema parity, and send Slack alerts on success or failure.
Automating backups is only half the battle: an unverified backup is an outage waiting to happen. Silent schema corruptions, broken permissions, or incomplete pg_dump executions frequently go unnoticed until disaster strikes and recovery fails.
This blueprint implements a disaster recovery workflow for PostgreSQL: it schedules automated custom-format pg_dump backups, streams the archive to Amazon S3, and immediately performs an automated restore drill into an ephemeral scratch database. Only backups that pass full schema and table parity checks are certified and announced to the team.
source_stats queries information_schema.tables on the production database using the PostgreSQL JDBC plugin to record baseline table counts.dump_database launches a postgres:16-alpine container via Docker task runner and runs pg_dump -F c -b -v to generate a compressed custom-format archive, recording the byte size.upload_to_s3 uses the AWS S3 plugin (io.kestra.plugin.aws.s3.Upload) to ship the timestamped archive to a secured S3 backup bucket.restore_drill launches a container to restore the archive into a dedicated scratch database (restore_database) using pg_restore --clean --if-exists.restore_stats inspects the scratch database and counts the restored user tables.verify_backup_integrity (io.kestra.plugin.core.flow.If) compares source and restored table counts:Fail.errors block catches unexpected worker failures, network issues, or S3 upload timeouts.restore_database to production).s3:PutObject permission.POSTGRES_HOST: Hostname or IP of the PostgreSQL server.POSTGRES_PORT: Port of the PostgreSQL server (default 5432).POSTGRES_USER: PostgreSQL user with pg_read_all_data / dump permissions.POSTGRES_PASSWORD: Password for the PostgreSQL user.AWS_ACCESS_KEY_ID: AWS IAM access key ID.AWS_SECRET_ACCESS_KEY: AWS IAM secret access key.SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for backup status alerts.restore_drill_db) is created on your test PostgreSQL server.s3_bucket and database inputs to match your environment.nightly_backup_schedule active for recurring 02:00 UTC runs.source_stats and restore_stats to query exact pg_stat_user_tables.n_live_tup or run checksum queries on critical tables.