Skip to content

yugabyte/ybm-cli

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
cmd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ybm-cli

A CLI implementation for YB Managed.

Install with brew

  • brew install yugabyte/yugabytedb/ybm

Global configuration

This CLI support 3 possibles configurations:

  • Passing values as flags

    ybm --apiKey AWERDFSSS --host cloud.yugabyte.com cluster list
  • Using a configuration file called .ybm-cli.yaml under your $HOME directory. You can use the command ybm auth to help to setup the file

  • Using environment variables (all need to start with YBM_)

    export YBM_APIKEY=AWERDFSSS
    export YBM_HOST=cloud.yugabyte.com
    ybm cluster list

By default, https will be added to the host if no scheme are provided if you want to use http just add it to the host http://cloud.yugabyte.com

Demo of the CLI

Commands list

You can find all command documentation here

Sample Commands:

Cluster

Create Cluster

Minimal Required Configurations
ybm cluster create \
    --cluster-name=test-cluster \
    --credentials=username=admin,password=YBM.Is.Always.Great! 

This will use configured default values to spawn the cluster. A single node synchronous cluster will be provisioned in AWS in the us-west-2 region with 2 vCPUs, 4GB RAM and 10GB disk.

All possibilities
ybm cluster create
    --cluster-name=test-cluster \
    --credentials=username=admin,password=YBM.Is.Always.Great! \
    --cloud-provider=[AWS or GCP] \
    --cluster-type=[SYNCHRONOUS or GEO_PARTITIONED] \
    --node-config=num-cores=<num-cores>,disk-size-gb=<disk-size-gb> \
    --region-info=region=<region-name>,num-nodes=<number-of-nodes>,vpc=<vpc-name> \
    --cluster-tier=[Sandbox or Dedicated] \
    --fault-tolerance=[NONE or ZONE or Region] \
    --database-version=[Stable or Preview] 

List Clusters

ybm cluster list 

Describe Cluster

ybm cluster describe \
    --cluster-name=test-cluster-1

Delete Cluster

ybm cluster delete \
    --cluster-name=test-cluster-1

Network Allow List

Create Network Allow List

ybm network-allow-list create \
     --name=admins \
     --description="admin allow list" \
     --ip-addr=0.0.0.0/12, 1.1.1.1/12 

List Network Allow Lists

ybm network-allow-list list

Filter Network Allow List

ybm network-allow-list list \
    --name=admins

Assign network allow list to cluster

ybm cluster network allow-list assign \
     --cluster-name=test-cluster \
     --network-allow-list=admins 

Delete Network Allow List

ybm network-allow-list delete \
    --name=admins

Read Replica

Create Read Replica

ybm cluster read-replica create \
     --cluster-name=test-cluster \
     --replica=num-cores=<num-cores>,memory-mb=<memory-mb>,disk-size-gb=<disk-size-gb>,code=<GCP or AWS>,region=<region>,num-nodes=<num-nodes>,vpc=<vpc-name>,num-replicas=<num-replicas>,multi-zone=<multi-zone> 

The --replica tag is optional. If omitted, a single read replica will be created for the given cluster with default values. Additional replicas can be created by repeating the --replica flag but each replica must be in a distinct region. For now all the replicas need to be specified while updating.

List Read Replicas

ybm cluster read-replica list \
    --cluster-name=test-cluster

Update Read Replicas

ybm cluster read-replica update \
     --cluster-name=test-cluster \
     --replica=num-cores=<num-cores>,memory-mb=<memory-mb>,disk-size-gb=<disk-size-gb>,code=<GCP or AWS>,region=<region>,num-nodes=<num-nodes>,vpc=<vpc-name>,num-replicas=<num-replicas>,multi-zone=<multi-zone> 

The --replica tag is optional. If omitted, the cluster will be updated with a single read replica with default values. Additional replicas can be created by repeating the --replica flag but each replica must be in a distinct region. For now all the replicas need to be specified while updating.

Delete Read Replicas

ybm cluster read-replica delete \
     --cluster-name=test-cluster 
    

All the read replicas will be deleted. To delete only specific read replicas, use the update command.

VPC

Create VPC

ybm vpc create \
    --name=demo-vpc \
    --cloud-provider=GCP \
    --global-cidr=10.0.0.0/18

List VPCs

ybm vpc list

Filter VPC

ybm vpc list \
    --name=demo-vpc 

Delete VPC

ybm vpc delete \
    --name=demo-vpc 

VPC Peering

Create VPC Peering

ybm vpc peering create \
    --name=demo-peer \
    --vpc-name=demo-vpc \
    --cloud-provider=GCP \
    --project=project \
    --vpc=vpc-name \
    --region=us-west1 \
    --cidr=10.0.0.0/18 

List VPC Peerings

ybm vpc peering list

Filter VPC Peering

ybm vpc peering list \
    --name=demo-peer

Delete VPC Peering

ybm vpc peering delete \
    --name=demo-peer

Wait

All the long running commands like the cluster creation, cluster deletion etc have the --wait option to wait until the operation is completed.

ybm cluster delete \
    --cluster-name=test-cluster \
    --wait

If you are using the CLI with the --wait flag in your CI system you can specify the environment variable YBM_CI to true to avoid generating unnecessary logs lines.

By default, the --wait option timeout after 7 days, you can reduce or increase this timeout by using the --timeout option like

ybm cluster delete \
    --cluster-name=test-cluster \
    --wait
    --timeout 24h

Update REST API Client

  • make update-cli