Using ECS Service Broker for PCF

This topic describes how to use ECS Service Broker for Pivotal Cloud Foundry (PCF) after it has been installed.

Use ECS Service Broker for PCF with an App

To use ECS Service Broker for PCF with an app, follow the procedures in this section to create a service instance and bind the service instance to your app. For more information about managing service instances, see Managing Service Instances with the cf CLI.

View the Service

After the tile is installed, ecs-broker and its service plans appear in your Marketplace. Run cf marketplace to see the service listing.

$ cf marketplace
Getting services from marketplace in org test / space test as admin...
OK

service            plans                             description
ecs-bucket         5gb, unlimited*                   Elastic Cloud S3 Object Storage Bucket

Create a Service Instance

Use cf create-service to provision a bucket.

The following example creates a 5gb service that provisions a bucket.

$ cf create-service ecs-bucket 5gb my-bucket

Check the creation status using cf services. This displays a list of all your service instances. To check the status of a specific service instance, run cf service NAME-OF-YOUR-SERVICE.

Bind the Service Instance to an App

After you create your bucket, run cf bind-service to bind the service to your app.

$ cf bind-service sample-app my-bucket

Restage or Restart Your App

To enable your app to access the service instance, run cf restage or cf restart to restage or restart your app.

Obtain Service Instance Access Credentials

After you bind your service instance to your app, you can find the credentials of your ECS S3 user in the environment variables of the app.

Run cf env APP-NAME to display environment variables. The credentials are listed under the VCAP_SERVICES key.

$ cf env sample-app
Getting env variables for app sample-app in org test / space test as admin...
OK

System-Provided:
{
 "VCAP_SERVICES": {
  "ecs-bucket": [
   {
    "credentials": {
     "access_key_id": "EXAMPLE-ACCESS-KEY",
     "bucket": "ecs-cf-broker-c369db61-8382-49c7-a1d4-75e6a5a43786",
     "endpoint": "EXAMPLE-ECS-OBJECT-END-POINT-URL",
     "s3Url": "http://:@/ecs-cf-broker-c369db61-8382-49c7-a1d4-75e6a5a43786",
     "secret_access_key": "EXAMPLE-SECRET-ACCESS-KEY"
    },
    "label": "ecs-bucket",
    "name": "my-bucket",
    "plan": "5gb",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "s3",
     "bucket"
    ],
    "volume_mounts": []

   }
  ]
 }
}
...

You can use the access key ID, secret access key, bucket, and region to connect to a bucket.

Delete an ECS Service Broker for PCF Service Instance

Follow the instructions below to unbind your service instance from all apps and delete it.

WARNING! This operation cannot be undone, and all the data is lost when the service is deleted. Before deleting a service instance, you must back up the data stored in your bucket.

List Available Services

Run cf service to list your available services.

$ cf service

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

name           service    plan    bound apps   last operation
my-bucket      ecs-bucket 5gb     sample-app   create succeeded

The above example shows that my-bucket is bound to the sample-app app.

Unbind a Service Instance

Run cf unbind to unbind the service from your app:

$ cf unbind-service sample-app my-bucket

Delete a Service Instance

Run cf delete-service to delete the service.

  $ cf delete-service my-bucket

Run the cf services command to check the deletion status.

Create a pull request or raise an issue on the source for this page in GitHub