Provision with CLI

Install the CLI

It can can be installed with homebrew by running:

brew install CrunchyData/brew/cb

You can update to newer versions with:

brew upgrade cb

You can also find packaged releases available on GitHub

Tutorial

A tutorial is available on YouTube at https://www.youtube.com/watch?v=tZNfZ-rl65I.

Tab Completion

The Crunchy Bridge CLI offers tab completion so you can easily find the syntax for line completion. The CLI works best when used with the Fish (Friendly Interactive Shell) shell.

Authentication and API Keys

The CLI will connect to your Bridge account via an API key available in your Account Settings. The first time you will need to create an API key and this will remain part of your account until you delete it.

bridge account api

After creating your API key, run:

cb login

And paste the login and secret key when prompted. To confirm that you are logged in, or to request your user id or name run cb whoami.

Creating a cluster

command about required default value values
-h, –help Show this help no
–plan Plan (server vCPU+memory) yes hobby-2, hobby-4, hobby-8, hobby-16, standard-8, standard-16, standard-32, standard-64, standard-128, standard-192, standard-384, memory-16, memory-32, memory-64, memory-128, memory-512, memory-768
-n, –name Cluster name no Cluster date+time You can create custom cluster names with standard ascii characters
-p, –platform Cloud provider yes aws, azr, gcp
-r, –region Region region GCP asia-northeast1 (Asia Northeast 1 [Tokyo]) asia-south1 (Asia South 1 [Mumbai]) australia-southeast1 (Australia Southeast 1 [Sydney]) europe-north1 (Europe North 1 [Finland]) europe-west1 (Europe West 1 [Belgium]) europe-west3 (Europe West 3 [Frankfurt]) northamerica-northeast1 (North America Northeast [Montreal]) us-central1 (US Central 1 [Iowa]) us-east4 (US East 4 [Virginia]) us-west1 (US West 1 [Oregon]) AWS ap-northeast-1 (AP Northeast 1 [Tokyo]) ap-southeast-1 (AP Southeast 1 [Singapore]) ap-southeast-2 (AP Southeast 2 [Sydney]) ap-south-1 (AP South 1 [Mumbai]) ca-central-1 (Canada Central [Toronto]) eu-central-1 (EU Central [Frankfurt]) eu-north-1 (EU North [Stockholm]) eu-south-1 (EU South [Milan]) eu-west-1 (EU West 1 [Ireland]) eu-west-3 (EU West 3 [Paris]) sa-east-1 (SA East 1 [Sao Paulo]) us-east-1 (US East [N. Virginia]) us-east-2 (US East 2 [Ohio]) us-west-1 (US West 1 [N. California]) us-west-2 (US West 2 [Oregon]) Azure australiaeast (Australia East [Australia]) australiasoutheast (Australia Southeast [Australia]) canadacentral (Canada Central [Toronto]) centralus (Central US [Iowa])
-s, –storage Size of cluster in GB yes Any number from 10 - 20480
-t, –team Team ID yes To get your list of team ids, use cb teams
–network Network no New network To get the network of an existing cluster, use the cb info command
–replica Command to create replica of existing cluster no Input the id of the cluster you want to replicate. Cluster ids can be found with cb list
–fork Command to create a fork / point-in-time recovery of an existing cluster no Input the id of the cluster you want to fork, Cluster ids can be found with cb list
–at time Time for create fork/PITR no Current time Recovery point in RFC3339 for the last 10 days. Example UTC: 2021-10-12T23:20:50.52Z or with timezone offset: 2021-10-12T16:20:50.52-07:00

Sample input for new cluster

cb create --platform aws --plan standard-8 --region us-east-2 --ha false --storage 100 -t fb545b7f7jfbhfrrdnnupz6qvm

Sample output

Created cluster vz72xkaswnbhpaxddxzfhzgimq "Cluster 2021-10-19 15_02_09"

Sample input for new replica

cb create --platform aws --plan hobby-2 --region us-east-2 --ha false --storage 10 --replica vz72xkaswnbhpaxddxzfhzgimq --team fb545b7f7jfbhfrrdnnupz6qvm

Sample output

Created cluster ojmu5tgjj5cn5gm763oto6irf4 "Replica of Cluster 2021-10-19 15_02_09"

CLI Commands

You can find the full directory of CLI commands with CLI --help:

| Command  | Description                                                  |
| -------- | ------------------------------------------------------------ |
| login    | Stores your api id and secret for a single session in a command line |
| list     | List the active clusters for your entire account for all teams |
| info     | Input the cluster id and returns information about your cluster |
| psql     | Input the cluster id and connects to cluster with psql as postgres user |
| firewall | Input the cluster id, view or change firewall rules          |
| create   | Create a new cluster, create a fork, or create a replica. Input platform, zone, and machine specifications to create a new cluster |
| destroy  | Deletes a cluster                                            |
| logdest  | View or update the log destinations for a cluster            |
| scope    | This will run a helpful set of queries to get insights into your cluster and database health |
| teamcert | This will show you the certificate for a team which can be used to check certificates |
| teams   | Returns the team id, name, and permissions you hold with all of your teams |
| token    | Returns a token that is required for use when interacting with the API. Read more about tokens in the API docs |
| version  | Show the version and last updated date of the CLI tool       |
| help     | Shows the help                                               |