How to check if service instance is bound to an app
search cancel

How to check if service instance is bound to an app

book

Article ID: 297214

calendar_today

Updated On:

Products

VMware Tanzu Application Service

Issue/Introduction

In an environment, where there is a lot of service instance deployments, you can check what apps are bound to the service instance via cf cli.

This articles covers how to determine if apps are bound to the service.

Environment

TAS 

Resolution

Get a full list of BOSH deployments using the command: bosh ds --column=name

Example bosh deployments output:

cf-cd7cc3cd4db8a9288f57
service-instance_1cc6031d-2ca4-4743-8449-533a8ec54524
service-instance_0e6b921e-5d04-44ad-9e21-2cd140f0c4f2

or else to check in cf cli use command:

cf curl /v3/service_instances


To find service bindings for these deployments use CF CLI command:

cf curl /v3/service_instances/<guid>/service_bindings


Where the <guid> variable is presented in the bosh ds output above, or else can be retrieved in cf cli with command:

cf service <service name> --guid


Example 1

This service is not bound to any application. In this example, no results were found. This deployment is not being utilized by any of the cf deployed apps.

cf curl /v3/service_instances/0e6b921e-5d04-44ad-9e21-2cd140f0c4f2/service_bindings

Output: 

{ "total_results": 0, "total_pages": 1, "prev_url": null, "next_url": null, "resources": [] }


Example 2

This service is bound to an application. The output demonstrates that 1 result was found.

In this example, to narrow down the app bound to this service by name use command:

cf curl /v3/service_instances/1cc6031d-2ca4-4743-8449-533a8ec54524/service_bindings

Output:

{ "total_results": 1, "total_pages": 1, "prev_url": null, "next_url": null, "resources": [ { "metadata": { "guid": "97e0d2b6-3cc2-4c56-993e-29069eaf6b28", "url": "/v2/service_bindings/97e0d2b6-3cc2-4c56-993e-29069eaf6b28", "created_at": "2021-09-09T16:38:38Z", "updated_at": "2021-09-09T16:38:39Z" }, "entity": { "app_guid": "70785a53-6124-40d6-901c-7df16f03c1ef", "service_instance_guid": "1cc6031d-2ca4-4743-8449-533a8ec54524", "credentials": { "hostname": "1cc6031d-2ca4-4743-8449-533a8ec54524.mysql.service.internal", "jdbcUrl": "jdbc:mysql://1cc6031d-2ca4-4743-8449-533a8ec54524.mysql.service.internal:3306/service_instance_db?user=97e0d2b63cc24c56993e29069eaf6b28&password=redacted&sslMode=VERIFY_IDENTITY&useSSL=true&requireSSL=true&enabledTLSProtocols=TLSv1.2&serverSslCert=/etc/ssl/certs/ca-certificates.crt", "name": "service_instance_db", "password": "redacted", "port": 3306, "tls": { "cert": { "ca": "-----BEGIN CERTIFICATE-----\n\n-----END CERTIFICATE-----\n" } }, "uri": "mysql://mysql.service.internal:3306/service_instance_db?reconnect=true", "username": "" }, "binding_options": {}, "gateway_data": null, "gateway_name": "", "syslog_drain_url": null, "volume_mounts": [], "name": null, "last_operation": { "type": "create", "state": "succeeded", "description": "", "updated_at": "2021-09-09T16:38:39Z", "created_at": "2021-09-09T16:38:39Z" }, "app_url": "/v2/apps/70785a53-6124-40d6-901c-7df16f03c1ef", "service_instance_url": "/v2/service_instances/1cc6031d-2ca4-4743-8449-533a8ec54524", "service_binding_parameters_url": "/v2/service_bindings/97e0d2b6-3cc2-4c56-993e-29069eaf6b28/parameters" } } ] }



Additional Information

The command can run for api v2 and api v3, for example:

cf curl /v2/service_instances or cf curl /v3/service_instances