Compose for ElasticSearch 101

Compose is for database management and provisioning in which also gives a dashboard for monitoring database instances.

Compose is a part of IBM and supports the IBM Cloud platform.

Compose on IBM Cloud offers a variety of supported databases with the sole goal of assisting developers to focus on creating rather than focusing on worrying about database backends.

Today we will do a walkthrough of Compose for ElasticSearch.

You will need an account on IBM Cloud platform first.

Next step is creating the service on IBM Cloud by going into the catalog of services and finding ‘Compose for ElasticSearch’ in the Data and Analytics portion of the platform’s catalog of services.

IBM Cloud Catalog

Create a service of Compose for ElasticSearch on IBM Cloud. You will be directed to create an account on Compose from here.

Compose account made, then deploy ElasticSearch

So now you can go down two roads from here. Administrate via the Compose account with the couple of commands as shown in this tutorial, here, done by Dj Walker-Morgan.

Or go with my tutorial as adapted from here by Dj Walker-Morgan, and use the list of available API calls I link to below in the title ‘Available API Calls List’.

Platform API Keys

Now you are going to need to fetch your platform API keys.

So would you rather use API keys or would you rather put your username and password down in a program or script? API keys, so we can use these for various services on the platform.

Click on ‘Platform API Keys’ under Manage in your navbar

Click on the “Create +” on the right hand side of the page.

Provide a name to your API keys

Download this API Key in a respect you prefer.

Now we can focus on Compose for ElasticSearch again.

Open up the landing page for the service instance in your Dashboard console of IBM Cloud.

Now its time to gather credentials to being able to use the API.

Compose Credentials

Scroll down until you see something titled on this page called “Instance Administration API” under the Connection Strings section.

Taken from docs, these are not my creds.

Available API Calls List

Okay you are set up now for Compose API calls. Through the Compose documentation there are a number of commands supported, detailed here at the bottom of the page titled “Available API calls”.

Command Line Setup

You are going to have to install the IBM Cloud command line interface for this part of doing a command with cURL.

cURL

cURL is used to transfer data through various protocols like HTTP here, as a command line tool. It comes with some operating systems, like I don’t think I have ever seen a Linux distro I have used without it (Debian you have to install just about everything so, yes. Windows, yes. I think UNIX too).

The link to this looks shady but allow me to assure you, everyone in the world has ran that through VirusTotal repeatedly.

IBM Cloud CLI

The installers are right here, bx installation.

Here are the commands for this CLI for logging into IBM Cloud.

Watch which region your API endpoint is:

US South and US East bx login -a api.ng.bluemix.net
Sydney and AP North bx login -a api.au-syd.bluemix.net
Germany bx login -a api.eu-de.bluemix.net
United Kingdom bx login -a api.eu-gb.bluemix.net

We will do an API call for GET deployments. Remember your region, if you are not in US-South for your region (as listed above) your endpoint will be different than my command.

curl -s -X GET -H 'authorization: Bearer 'platform_apiKey -H 'content-type: application/json' https://composebroker-dashboard-public.mybluemix.net/api/2016-07/instances/Foundation_Endpoint/deployments/Deployment_ID

The result should be…

bash-3.2# curl -s -X GET -H 'authorization: Bearer 'Platform_API_Key -H 'content-type: application/json' https://composebroker-dashboard-public.mybluemix.net/api/2016-07/instances/XXXXX-XXXXX-XXXXXX-XXX/deployments/XXXXXXXXXXX
{"id":"XXXXXXXXX","account_id":"XXXXXXXXXXXX","name":"xxxxxxxxxx","type":"elastic_search","created_at":"2017-12-01T21:19:09.834Z","notes":"","customer_billing_code":"","cluster_id":"XXXXXXXX","ca_certificate_base64":"XXXXXXXX","connection_strings":{"direct":["https://admin:XXXXXXXX@portal-sslXXX-XX.bmix-dal-yp-XXXX-XXXX-XXXX-XXXX-XXXXXXXc.email-address-email-com.composedb.com:32323/","https://admin:XXXXXXXX@portal-ssl370-16.bmix-dal-yp-XXXXX-XXXX-XXXX-XXXX-XXXXXX7fcdc.email-address-email-com.composedb.com:323323/"],"cli":[],"maps":[],"misc":{"direct_kibana":[]},"ssh":[],"health":["curl -u admin:XXXXXXXXX 'https://portal-XXXXX-XX.bmix-dal-yp-XXXXX-XXXX-XXXX-XXXX-XXXXXX7fcdc.email-address-email-com.composedb.com:xxxxx/_cluster/health?pretty'","curl -u admin:XXXXXXXX 'https://portal-xxxx-16.bmix-dal-yp-XXXXX-XXXX-XXXX-XXXX-XXXXXX7fcdc.email-address-email-com.composedb.com:XXXX/_cluster/health?pretty'"],"admin":[]},"version":"2.4.6"}bash-3bash-3.2#
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.