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.yamlunder your$HOMEdirectory. You can use the commandybm authto 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
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-1Delete Cluster
ybm cluster delete \
--cluster-name=test-cluster-1Network 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 listFilter Network Allow List
ybm network-allow-list list \
--name=adminsAssign 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=adminsRead 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-clusterUpdate 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/18List VPCs
ybm vpc listFilter 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 listFilter VPC Peering
ybm vpc peering list \
--name=demo-peerDelete VPC Peering
ybm vpc peering delete \
--name=demo-peerWait
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 \
--waitIf 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 24hUpdate REST API Client
- make update-cli
