In this blog posting we will be looking at BigAnimal cluster management via BigAnimal’s CLI.
In the previous blog posting: “Managing BigAnimal Clusters with BigAnimal APIs”, we reviewed and explained: What DBaaS is, what BigAnimal is, what a BigAnimal Cluster is, and discussed BigAnimal is, its features and capabilities.
Command Line Interface
A command line interface ( aka CLI ), is a method for interaction with applications and/or services for specific tasks. CLIs have been around since the 1960s, they allow users to perform tasks by entering commands and parameters via the command line. Sometimes a CLI makes calls to APIs.
Downloading BigAnimal CLI
The BigAnimal CLI is downloaded with the following command:
curl -LO "https://cli.biganimal.com/download/$(uname -s)/$(uname -m)/latest/biganimal"
While there is no need to install the BigAnimal CLI, the downloaded BigAnimal CLI file must be made executable in order to be used:
chmod +x ./biganimal
Creating a Credential
Before performing execution of subcommands with the BigAnimal CLI, a credential must be created in order to be able to gain access to BigAnimal.
The command line below provides the parameter values for the create-credential subcommand.
./biganimal create-credential --name <credential_name> --address portal.biganimal.com --port 443
A code will be provided along with a URL to activate the credential created.
Activating a Credential
To activate the credential the following steps must be completed:
- Copy the code provided in the Creating Credentials step
- Navigate in a browser to the provided URL
- Click Confirm Button
A successful activation will be indicated in the command line and should be similar to this
Credential ““<credential>”” is created operation succeeded ““<credential>”” Credential context setup operation succeeded
Creating a Cluster
Once a credential has been created, and activated successfully, we are ready to proceed to creating the cluster with the command below:
You will be prompted for the values of the following parameters, do not worry if you do not know them because you will be provided with options for choosing the appropriate values.
- Cluster Name
- Postgresql Type
- Postgresql Version
- Instance Type
- Volume Type
- Volume Properties
- High Availability
- Confirmation of cluster creation
A successful cluster creation will provide a message that looks somewhat as below
To check current state, run: biganimal show-cluster --id <id>
Listing clusters can be achieved by providing not only the ID of the cluster as a parameter, but also the type of output desired for the list of clusters. For example by adding the “-o” parameter to the show-clusters subcommands you can choose from: xml, table, json and table.
Showing clusters available to the current credentials:
Listing clusters and display results in json:
./biganimal show-clusters -o json
Listing clusters filtered by a provided cluster ID:
./biganimal show-clusters --id <id>
Deleting clusters is accomplished by providing the cluster id, which can be retrieved by listing the cluster details with the show-clusters subcommand.
./biganimal delete-cluster --id <id>
In this blog we:
- Learned how to download BigAnimal CLI
- Created, and activated a BigAnimal credential
- Learned how to create, list, and delete a BigAnimal cluster
See you in the next blog post!