Reducing iteration time by using a custom PostgreSQL broker
The cloud.gov team recently deprecated shared database instance plans.
Unlike dedicated instance plans, which each provision a separate RDS database instance and take a while to create, shared instance plans re-used the same RDS database instance and created new databases within the same instance, which completed almost instantly.
You can replicate the behavior of the deprecated shared instance plans using an
open-source service broker known as
Please note that while this approach has been tested manually, the
postgres-tinsmith repo is not
actively maintained by the cloud.gov team, so this documentation is provided as a proof-of-concept only and does not offer any guarantees of production-readiness.
1. Create a dedicated RDS service
View our available dedicated RDS instance plans for PostgreSQL:
cf marketplace -e aws-rds
Create a PostgreSQL service using one of the dedicated instance plans. For example:
cf create-service aws-rds micro-psql <dedicated-db-name>
2. Deploy and configure
Follow the instructions in the repo README to create and configure the
postgres-tinsmith service broker.
Make sure to use the
<dedicated-db-name> created in step 1 as the database service name to bind to
3. Create a database
postgres-tinsmith is deployed and configured, create a database using the new
shared plan of the
cf create-service postgres shared <db-name>
4. Bind database to your application
cf bind-service <application-name> <db-name> cf restage <application-name>
Alternately, you can bind the database service to your application using a
Verifying your bound database service
cf env <application> (e.g.
cf env postgres-example-app) should show information about the
<db-name> in the
VCAP_SERVICES environment variable. See the CloudFoundry
documentation for more information about
5. Use the database in your application
Make sure that your application properly reads and implements the credentials for the database from
VCAP_SERVICES environment variable.