How do I rotate the credentials for a Heroku Postgres database?

Issue

I want to rotate the credentials used to access a Heroku Postgres instance.

Resolution

You can rotate the credentials for a database by following the instructions here: https://devcenter.heroku.com/articles/heroku-postgresql-credentials#pg-credentials-rotate Provided that your application is using the value of the DATABASE_URL environment variable this should not cause any disruption, as the app will be restarted to pick up the new credentials. You can find instructions on connecting in various languages here: https://devcenter.heroku.com/articles/heroku-postgresql#table-of-contents

If you are connecting to these databases externally you would need to manually re-enter the new credentials or setup a system to poll for changes using the Heroku Platform API https://devcenter.heroku.com/articles/platform-api-reference#config-vars-info-for-app

Heroku does not perform and scheduled credential rotation for Common Runtime databases. However, during certain types of maintenance events (for example patching for security) the credentials will be rotated automatically.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support