Using Altoros AWS S3 for PCF

This topic describes how to use Altoros AWS S3 for Pivotal Cloud Foundry (PCF) after it has been installed.

Use Altoros AWS S3 for PCF with an App

To use Altoros AWS S3 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, aws-s3 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
aws-s3             basic, basic-public               Amazon S3 provides developers with secure, durable, highly-scalable object storage

Create a Service Instance

Use cf create-service to provision a bucket.

The following example creates a basic service that provisions a private bucket.

$ cf create-service aws-s3 basic my-s3-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-s3-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 AWS 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": {
  "aws-s3": [
   {
    "credentials": {
     "access_key_id": "EXAMPLE-ACCESS-KEY",
     "bucket": "cf-4c407938-2d43-4a27-80c6-b30251002f87",
     "region": "eu-central-1",
     "secret_access_key": "EXAMPLE-SECRET-ACCESS-KEY"
    },
    "label": "aws-s3",
    "name": "my-s3-bucket",
    "plan": "basic",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "AWS",
     "S3",
     "object-storage"
    ],
    "volume_mounts": []
   }
  ]
 }
}
...

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

Delete an Altoros AWS S3 for PCF Service Instance

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

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

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-s3-bucket   aws-s3    basic   sample-app   create succeeded

This example shows that my-s3-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-s3-bucket

Delete a Service Instance

Run cf delete-service to delete the service.

  $ cf delete-service my-s3-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