Skip to main content

Connect to pre-production data

Problem

We cannot use production data directly, but we must observe the data.

Please see operational restrictions.

Consider refreshing preprod if you need more up-to-date data.

Actions

Warning Please read data at rest on MoJ-issued laptops for guidance on storing sensitive data (query output).

Use the port forwarding script from the operational scripts.

./setup_preprod_port_forward.sh

You should see:

{snip}
Forwarding from 127.0.0.1:5433 -> 5432
Forwarding from [::1]:5433 -> 5432

Then, you can connect locally:

psql -h localhost -p 5433 -U cpunRCHNiS db6a9cfbef8ecc3a97

The password to use is in:

cloud-platform decode-secret \
  --secret=postgres14 \
  --namespace=hmpps-interventions-preprod

Now we have read-replica for each namespace which is used for reporting / read only load.

To connect to read-replica, make a copy of setup_preprod_port_forward.sh and rename appropriately (e.g. setup_preprod_replica_port_forward.sh). Make appropriate changes to point to read replica database.

./setup_preprod_replica_port_forward.sh

The password to use is in:

cloud-platform decode-secret \
  --secret=hmpps-interventions-postgres14-rds-replica-output \
  --namespace=hmpps-interventions-preprod

cloud-platform is the Cloud Platform CLI tool.

This page was last reviewed on 5 March 2025. It needs to be reviewed again on 5 March 2026 by the page owner #interventions-dev .
This page was set to be reviewed before 5 March 2026 by the page owner #interventions-dev. This might mean the content is out of date.