Configure Object Store to use Google Cloud

The Object Store service on Google Cloud provides Google Cloud Storage bucket as object store resource.

Context

The Object Store service provisions a Google Cloud Storage bucket as part of Object Store instance creation. It generates credentials in the form of Google Cloud IAM service account technical user during service binding or service key creation operations. The service also supports invalidating and deleting the credentials as part of service unbind and service key deletion operations. In addition, it supports service instance update and delete operations.

The following tasks can be completed using the SAP BTP cockpit. For more information, see Managing Services Using the SAP BTP Cockpit.

Procedure

The following example demonstrates how to perform the create-service and bind-service operations. Similarly, it can also be done for the other supported plans.

  1. Look for available services on Cloud Foundry using the command cf marketplace. You can see a service called objectstore available with plan standard.
    Service: objectstore Plans: standard Description: Objectstore service
  2. Create a service instance of the above service and plan using the command cf create-service objectstore standard <serviceInstanceName>.
  3. List the services available using the command cf services and you can find create-succeeded after the service instance creation is completed. Please note that it might take a while before the operation gets completed, until which in progress could be seen under last operation field.
    Name || Service || Plan || Bound apps || Last operation
    <serviceInstanceName> || objectstore || standard
  4. If you need to bind five or fewer applications to a service instance, you can directly use: cf bind-service <applicationName> <serviceInstanceName>; otherwise, use the service key approach described in sub steps bellow to support more than five application bindings:
    1. Create a service key to generate credentials to access the storage: cf create-service-key <serviceInstanceName> <keyName>.
    2. Get the service key credentials to access the storage using: cf service-key <serviceInstanceName> <keyName>.

      The following is an example of the output:

      "credentials": 
      {
      	"base64EncodedPrivateKeyData": "<base64_encoded_service_account_credentials>", 
      	"projectId": "<project_id>", 
      	"keyAlgo": "<service_account_key_generation_algo>",
      	"region": "<region_of_bucket>", 
      	"bucket": "<some_bucket_name>" 
      }
    3. To bind your application with the service key, execute the following steps:
      1. Create a user provided service using the service key by providing the above credentials JSON as input to the command: cf create-user-provided-service.

      2. Bind your application with the user provided service using the command: cf bind-service <applicationName> <userProvidedServiceName>.

Results

The credentials can be read from application environment under VCAP_SERVICES: cf env <applicationName>.
{ 
	"VCAP_SERVICES": { 
	"objectstore": [ 
{ 
	"credentials": { 
	"base64EncodedPrivateKeyData": "<base64_encoded_service_account_credentials>", 
	"projectId": "<project_id>", 
	"keyAlgo": "<service_account_key_generation_algo>", 
	"region": "<region_of_bucket>", 
	"bucket": "<some_bucket_name>" 
	}, 
	"label": "objectstore", 
	"name": "<serviceInstanceName>", 
	"plan": "standard", 
	"provider": null, 
	"syslog_drain_url": null, 
	"tags": [ 
	"blobStore", 
	"objectStore" 
	], 
	"volume_mounts": [] 
	} 
  ] 
 } 
}
The following describes the parameters that are included in the credentials:
  • base64EncodedPrivateKeyData: Base 64 encoded string of the JSON credential of the service account

  • projectId: Google Cloud Project ID in which Google Cloud Storage bucket is created

  • keyAlgo: Key Algorithm

  • region: Region in which the bucket is created

  • bucket: Name of the bucket provisioned as part of instance creation