Note: This guide uses the Cloud Foundry CLI version 5. The instructions below are not compatible with any cf version > 5. Click here to get a description of the differences between CLI v5 and CLI v6.
Display the supported service types:
cf services -m
Display the instances of the services you have already provisioned:
cf services --full
Create a new instance of a service type and assign it a name:
cf create-service <service-type> <service-instance-name>
cf services -m to view the list of available service types for which you can create an instance. Use the name of the service type listed in the first column of the table.
Create a new instance of a service type, assign it a name, and immediately bind it to a deployed application:
cf create-service <service-type> <service-instance-name> --app <appnam>
Bind a service instance to a deployed application. Assumes that you have already deployed the application using
cf bind-service <service-instance-name> --app <appname>
cf services to view the name of your service instance (first column of second table).
Remove the binding between a service instance and an application:
cf unbind-service <service-instance-name> --app <appname>
Delete an instance of a service:
cf delete-service <service-instance-name>
To bind an existing service instance at the same time you deploy an application using
cf push, enter
y at the prompt then specify the number of the service instance from the provided list. For example (only relevant output and prompts of the
cf push command shown):
cf push ... Bind other services to application?> y 1: mysql-12365 Which service?> 1 Binding mysql-12365 to app4... OK
To create a new service instance at the time you deploy an application, and then bind the new service instance to the application, specify the appropriate prompts and information about the new service instance. For example (only relevant output and prompts of
cf push shown):
cf push ... Create services for application?> y 1: mongodb 2.0 2: mysql 5.5 3: postgresql 9.0 4: rabbitmq 2.8 5: redis 2.2 What kind?> 2 Name?> mysql-12365 1: 100: Shared server, shared VM, 1MB memory, 10MB storage, 10 connections Which plan?> 1 Creating service mysql-12365... OK Binding mysql-12365 to app... OK
Please sign in to leave a comment.