Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save glarrain/32c48ec01437f7c22d84586eca10443b to your computer and use it in GitHub Desktop.
Save glarrain/32c48ec01437f7c22d84586eca10443b to your computer and use it in GitHub Desktop.
How to connect a Heroku application to an Amazon RDS PostgreSQL instance, forcing SSL and certificate chain verification

1 - Download the RDS certificates (root plus region-specific intermediate ones) bundle:

wget -O config/rds-combined-ca-bundle.pem https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

2 - Add config/rds-combined-ca-bundle.pem to the repository and redeploy to Heroku.

3 - Update the DATABASE_URL env var:

'postgres://user:password@host/db_name?sslmode=verify-full&sslrootcert=config/rds-combined-ca-bundle.pem'

do not forget to surround with quotes

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment