Skip to content

Binding applications to a service instance

Daniel Smith edited this page Nov 3, 2016 · 13 revisions

An instance of a service must be created in order to bind your application to that service. See Creating a new Service Instance for instructions.

  1. On the TAP console, navigate to Applications from the main menu.
  2. Search for the application you wish to bind and click the See Details>> link on the far right of the application row. Binding an Application to a Service Instance
  3. On the application details page, select the Bindings tab to both see the services already bound to the application, and a list of the available services to choose for new bindings. Binding an Application to a Service Instance
  4. Click the Bind button for the service you want to bind to the application.
  5. The application must be restaged after binding to a service. Select the Restage>> button to restage the application.

##Accessing a Service from an Application Once your application is bound to the service, and your application is pushed (or restarted), credentials for the service instance will be delivered to the application runtime in an environment variable named VCAP_SERVICES. VCAP_SERVICES returns a JSON document containing objects that allow your application to access the service. You can access the environment variables of an application by invoking:

cf env APP-NAME

For detailed information, read [the Cloud Foundry docs] (http://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES).

Here are some implementation examples:

In the case of Spring projects, you should read the [Cloud Foundry documentation] (https://docs.cloudfoundry.org/buildpacks/java/spring-service-bindings.html#bind) on this topic.

Clone this wiki locally