Use Tanzu Postgres for Tanzu Application Service in Your App
This topic shows how to use Tanzu Postgres for Tanzu Application Service in your app.
Every app and service is scoped to a space. To use a service, an app must exist in the same space as an instance of the service. To use VMware Postgres for Tanzu Application Service in an app:
- Use the cf CLI to log in to the org and space that contains the app.
- Make sure a Tanzu Postgres for Tanzu Application Service instance exists in the same space.
- If the space does not already have a Tanzu Postgres for Tanzu Application Service instance, create one.
- If the space already has a Tanzu Postgres for Tanzu Application Service instance, you can bind your app to the existing instance.
- Bind the app to the Tanzu Postgres for Tanzu Application Service instance to enable the app to use Postgres.
Confirm Service Availability
For an app to use a service, the following must be true:
-
The service must be available in the Marketplace.
- To find out if it is available, run
cf marketplace
or cf m
.
- If the output lists postgres in the service column, on-demand VMware Postgres for Tanzu Application Service is available. If it is not available, ask your operator to install it.
For example:
-
An instance of the service must exist in its space.
- To confirm that a Postgres for Tanzu Application Service instance is running in the space, run
cf services
.
- Any postgres listings in the service column are service instances of on-demand Postgres for Tanzu Application Service in the space.
For example:
Create a Service Instance
On-demand plans are listed under the postgres service in the Marketplace. To create a service instance of the VMware Postgres for Tanzu Application Service on-demand plan, run:
cf create-service postgres POSTGRES_PLAN SERVICE_NAME
Where:
- POSTGRES_PLAN is one of the plans configured by the operator.
- SERVICE_NAME is a name for your service.
For example: