Binding Your Application to the Intelligent Environment Service Instance

Before you begin

You must create an Intelligent Environment service instance before you perform this step.

Cloud Foundry runtime uses the VCAP_SERVICES environment variable to communicate with a deployed application about its environment. To provision connection details for your service instance in the VCAP_SERVICES environment variable, you must bind your instance to your application.

Procedure

  1. Bind your application to the service instance by entering the following command:
    cf bind-service <your_app_name> <service_instance_name>

    Your application is bound to the <service_instance_name> instance, and Cloud Foundry returns the following message:

    Binding service <service_instance_name> to app <your_app_name> in org predix-platform / space predix as userx@ge.com...
    OK
    
    Tip: Use the cf restage command to make sure your environmental variable changes take effect.
  2. Enter the following command to verify the binding:
    cf env <your app name>

Results

A message similar to the following is returned. The VCAP_SERVICES provides the oauth-scope, while the predix-uaa section provides the "uri": "https://a14f01fc-f50e-4db7-8bb0-bed1c887ea98.predix-uaa.run.aws-usw02-pr.ice.predix.io", which is used when logging in to the Predix Starter Kit.
Getting env variables for app your_app_name in org cf_org_name / space cf_space_name as cf_user_name...
OK
{
 "VCAP_SERVICES": {
  "predix-ie-<service instance name>-dev": [
   {
    "credentials": {
     "instanceId": "69c2bd61-4526-4379-9533-a2721fe83ba8",
     "uri": "http://predix-<service instance name>-<production URL>",
     "zone": {
      "http-header-name": "Predix-Zone-Id",
      "http-header-value": "69c2bd61-4526-4379-9533-a2721fe83ba8",
      "oauth-scope": "predix-<service instance name>.zones.69c2bd61-4526-4379-9533-a2721fe83ba8.user"
     }
    },
    "label": "predix-<service instance name>",
    "name": "test<service instance name>",
    "plan": "<your_plan_name>",
    "tags": []
   }
  ]
 }
}
 "predix-uaa": [
   {
    "credentials": {
     "issuerId": "https://a14f01fc-f50e-4db7-8bb0-bed1c887ea98.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token",
     "uri": "https://a14f01fc-f50e-4db7-8bb0-bed1c887ea98.predix-uaa.run.aws-usw02-pr.ice.predix.io",
     "zone": {
      "http-header-name": "X-Identity-Zone-Id",
      "http-header-value": "a14f01fc-f50e-4db7-8bb0-bed1c887ea98"
     }
    },
    "label": "predix-uaa",
    "name": "my_uaa_instance",
    "plan": "Tiered",
    "provider": null,
    "syslog_drain_url": null,
    "tags": []
   }
  ]
 }
}

What to do next

See Updating the OAuth2 Client to Use Your Service Instance.