Using Aerospike EE OnDemand Service for PCF

This topic describes how to use Aerospike EE OnDemand Service for Pivotal Cloud Foundry (PCF).

After installing and configuring the Aerospike EE OnDemand Service for PCF tile, developers can create service instances of Aerospike service plans and bind them to their apps using the Cloud Foundry Command Line Interface (cf CLI). Binding an Aerospike service instance to an app provides the app with information it can use to store and retrieve information in an Aerospike database.

When creating an Aerospike service instance, the tile will also create an Aerospike Management Console (AMC) that can be used to monitor the health and activity on the Aerospike cluster.

Create and Bind a Service Instance Using the cf CLI

To create an Aerospike service instance using the cf CLI, perform the following steps:

  1. Set your API endpoint to the Cloud Controller of your deployment.

    $ cf api api.YOUR-SYSTEM-DOMAIN
    Setting api endpoint to api.YOUR-SYSTEM-DOMAIN...
    API endpoint:  https://api.YOUR-SYSTEM-DOMAIN (API version: 2.59.0)
    Not logged in. Use 'cf login' to log in.

  2. Log in to your deployment and select an org and a space.

    $ cf login
    API endpoint: https://api.YOUR-SYSTEM-DOMAIN

  3. List the Marketplace services and locate the Aerospike service. The service plans match the namespaces that have been configured on the Aerospike database.

    $ cf marketplace
    Getting services from marketplace in org system / space apps-manager as admin...

    service plans description aerospike-on-demand small, medium, large An enterprise-class NoSQL database providing speed at scale

    TIP: Use 'cf marketplace -s SERVICE' to view descriptions of individual plans of a given service.

  4. Create an instance of the Aerospike service, specifying both the name of the service plan and the name of the service instance. This example uses the small plan.

    $ cf create-service aerospike-on-demand small YOUR-SERVICE-INSTANCE
    You can use arbitrary parameters to customize the service instance. See the Use Arbitrary Parameters section below for more information.

  5. Bind the instance to an app, adding a parameter with name setname, and set the value to the name of the set in the Aerospike database that this app should use to store its data.

    $ cf bind-service YOUR-APP YOUR-SERVICE-INSTANCE
    Binding service YOUR-SERVICE-INSTANCE to app YOUR-APP in org example / space development as
    TIP: Use 'cf restage YOUR-APP' to ensure your env variable changes take effect

  6. Restage the app for the binding to take effect.

    $ cf restage YOUR-APP
    The app now has all the credentials required to connect to the Aerospike database in the VCAP_SERVICES environment variable.

  7. Follow the steps in the Connect to the AMC section of this topic to connect to the AMC for your cluster.

Use Arbitrary Parameters

The Aerospike EE OnDemand Service for PCF supports a number of arbitrary parameters to customize the service instance either when creating the instance with cf create-service or when updating the instance with cf update-service.

Aerospike Service Parameters

Use the following parameters to customize the Aerospike service instance. If specified, these parameters take precedence over the defaults set up for the plan.

  • server_instances: Number of nodes in the cluster
  • server_vm_type: VM type to use for each of the cluster nodes, such as large.mem
  • server_persistent_disk_type: Type of disk to use on each of the cluster nodes

Aerospike Namespace Parameters

Use the following parameters to customize the namespace configured on the Aerospike service instance. If specified, these parameters take precedence over the defaults set up for the plan.

  • namespace_name: Name to use for the namespace
  • namespace_size: Memory-size to use for the namespace

    Note: For more information about configuring memory-size, see the Aerospike documentation.

  • namespace_storage_type: Storage type to use for the namespace, either Device or Memory
  • namespace_replication_factor: Number of copies of a record to be maintained in the cluster
  • namespace_default_ttl: Default time-to-live, in seconds, for a record from the time of creation or last update
  • namespace_filesize: Maximum size for each file storage defined in this namespace
  • namespace_data_in_memory: Boolean; if true, always keep a copy of all data in memory

AMC Parameter

Use the amc_route parameter to customize the route to use when configuring the AMC service. If not specified, a default route will be provided.


Pass arbitrary parameters with a valid JSON object containing the desired parameters. Provide the JSON either in-line or in a file.

Consult the following examples:

  • This command creates a service instance called small_cache that uses the small plan template, but uses as_cache for the name of the namespace:

    cf create-service aerospike-on-demand small small_cache -c '{"namespace_name":"as_cache"}'
  • This command updates an existing service instance and modifies the number of nodes in the cluster:

    cf update-service small_cache -c '{"server_instances":4}'
  • This command updates an existing service using a JSON file with the parameters:

    cf update-service small_cache -c /tmp/config.json

Note: If one or more arbitrary parameters are used to create or update a service, you must include those parameters with each update of the service. Otherwise, the default values from the plan will be used instead.

Connect to the AMC

To access the AMC for your cluster after creating an Aerospike service instance and binding it to an app, perform the following steps:

  1. Inspect the environment of the app to get the URL and credentials for the Aerospike Management Console.

    $ cf env YOUR-APP
    Getting env variables for app YOUR-APP in org aerospike-service-broker-org / space YOUR-SPACE as admin...
      "aerospike-on-demand": [
        "credentials": {
         "aerospike_amc_ips": [
         "aerospike_server_ips": [
         "amc_address": "",
         "hostname": "",
         "namespace": "as_datastore",
         "password": "XXXXXXXXXXXX",
         "port": 3000,
         "service_type": "small",
         "user": "admin"
  2. In a browser, navigate to the amc_address URL from VCAP_SERVICES to connect to the AMC.

  3. For Host Name or IP, enter the hostname IP address from VCAP_SERVICES and click Connect.
    Amc login 2

  4. For Username and Password, enter the user and password from VCAP_SERVICES and click Login.
    Amc login 3

  5. The Aerospike Management Console appears.

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