Skip to main content
Version: Develop

Lifecycle of a Service Instance

This page describes the lifecycle of all a9s Data Services' Service Instances, as well as how to enact all of its steps.

Use an a9s Data Service with an Application

To use an a9s Data Service with an application, it is necessary to create a Service Instance and bind it to the application. For more information about managing Service Instances, see Managing Service Instances with the cf CLI.

View the a9s Data Service

After the a9s Data Service is installed, a9s-dataservice and its Service Plans appear in the CF marketplace. Run cf marketplace to see the service listing:

cf marketplace
Output
Getting services from marketplace in org test / space test as admin...
OK
service plans description
a9s-dataservice dataservice-single-small, dataservice-single-big, dataservice-cluster-small, dataservice-cluster-big This is a Data Service that creates and manages dedicated a9s Data Service Instances, both single and clustered, powered by the anynines Service Framework.

Create a Service Instance

To provision an a9s Data Service's Service Instance, run cf create-service. For example:

cf create-service a9s-dataservice dataservice-single-small my-dataservice-service-instance

Depending on the infrastructure and Service Broker utilization, it might take several minutes to create the Service Instance.

Run the cf services command to view the creation status. This command displays a list of all the available Service Instances.

cf services
Output
Getting services in org test / space test as admin...
OK

name service plan bound apps last operation
my-dataservice-service-instance a9s-dataservice dataservice-single-small a9s-dataservice-app create succeeded

This example shows that my-dataservice-service-instance is bound to the a9s-dataservice-app application.

To view the status of a specific Service Instance, run cf service my-dataservice-service-instance.

Upgrade the Service Instance to another Service Plan

Once created, a Service Instance can be upgraded to another, larger service plan. A larger service plan provides more CPU, RAM and storage. For more information, see the Update a Service Instance of the Managing Service Instances with the cf CLI topic.

cf update-service my-keyvalue-service -p a-bigger-plan

Bind an Application to a Service Instance

After the database is created, run cf bind-service to bind the service to the application:

cf bind-service a9s-dataservice-app my-dataservice-service-instance

Restage or Restart an Application

To enable an application to access the Service Instance, run cf restage or cf restart to restage or restart the application.

Obtain Credentials for Accessing a Service Instance

After a Service Instance is bound to an application, the Service Instance's credentials are stored in the environment variables of the application. Run cf env APP-NAME to display the environment variables.

The credentials can be found in the VCAP_SERVICES key.

These credentials can be used to connect to the Service Instance's underlying vendored Data Service. For more information, see the Data Service specific sections.

Unbind a Service Instance

Run cf unbind-service to unbind the Service Instance from the application:

cf unbind-service a9s-dataservice-app my-dataservice-service-instance

Delete a Service Instance

danger

Before deleting a Service Instance the data stored in the associated database must be backed up, as this operation cannot be undone and all the data is lost when the Service Instance is deleted.

Before a Service Instance can be deleted, it must be unbound from all applications.

After unbinding the Service Instance, it is no longer bound to an application. Use cf delete-service to delete the Service Instance:

cf delete-service my-dataservice-service-instance

It might take several minutes to delete the Service Instance. Deleting a Service Instance deprovisions the corresponding infrastructure resources. Run the cf services command to view the deletion status.