DEV Community

Franck Pachot
Franck Pachot

Posted on • Edited on

YugabyteDB Managed CLI: provisioning a free DB from the command line

In the previous post about YugabyteDB managed, I have created a free YugabyteDB in the cloud using the REST API. If you want a simpler way here is the same with ybm, the YugabyteDB Managed CLI.

Install YBM CLI

I'm running this on my laptop on Windows. I get the latest version from https://github.com/yugabyte/ybm-cli/releases :

Image description

I have downloaded ybm_0.1.3_windows_amd64.zip and unzipped to get ybm.exe in the current directory (have it in the PATH)

I have set the API KEY and API host as an environment variable, see the previous post on how to get them (TL;DR: create an account in cloud.yugabyte.com and create an API key):

Image description

I can now use ybm to list the clusters and allow lists:

C:\Users\franck> ybm cluster list

No clusters found

C:\Users\franck> ybm network-allow-list list

Name               Description               Allow List                          Clusters
home                                         217.42.42.42/32
Enter fullscreen mode Exit fullscreen mode

Creation of Sandbox (Free tier)

I have no cluster yet, let's create a free one:

ybm cluster create ^
    --credentials=username=admin,password=Password-5up3r53cr3t ^
    --cloud-type=AWS ^
    --cluster-type=SYNCHRONOUS ^
    --node-config=num-cores=2,disk-size-gb=10 ^
    --region-info=region=eu-west-1,num-nodes=1 ^
    --cluster-tier=Sandbox ^
    --fault-tolerance=NONE ^
    --database-version=Preview ^
    --wait ^
    --cluster-name=my-free-yugabytedb

Enter fullscreen mode Exit fullscreen mode

I used --wait to see the creation steps:
Image description
Image description
Image description
Image description

I assign the IP Allow List to access it from home:

ybm cluster network allow-list assign ^
    --network-allow-list=home ^
    --cluster-name=my-free-yugabytedb

Enter fullscreen mode Exit fullscreen mode

Image description

I get the cluster ID with

ybm cluster describe ^
    --cluster-name=my-free-yugabytedb

Enter fullscreen mode Exit fullscreen mode

Image description

The host of the load balancer is region.cluster_id.YBM_HOST and I can connect with:

psql postgresql://admin:Password-5up3r53cr3t@eu-west-1.37a18be6-67fb-47e3-ab07-b85ab0020d56.cloud.yugabyte.com:5433/yugabyte?sslmode=require
Enter fullscreen mode Exit fullscreen mode

Single-Region (Fault Tolerance: AZ Level)

Here is how I create a Single-Region in Dedicated (Paid or Trial) over 3 regions in Tokyo:

ybm cluster create ^
    --credentials=username=admin,password=Password-5up3r53cr3t ^
    --cloud-type=AWS ^
    --cluster-type=SYNCHRONOUS ^
    --node-config=num-cores=4,disk-size-gb=200 ^
    --region-info=region=ap-northeast-1,num-nodes=3 ^
    --cluster-tier=Dedicated ^
    --fault-tolerance=ZONE ^
    --database-version=Preview ^
    --wait ^
    --cluster-name=my-single-region

Enter fullscreen mode Exit fullscreen mode

Image description

Multi-Region (Fault Tolerance: Region Level)

Here is the list of available regions in AWS:

ybm region list --cloud-provider AWS

Enter fullscreen mode Exit fullscreen mode

Image description

For multi-region we need VPC peering:
Image description

I create a GEO-PARTITIONNED with 3 --region-info:

ybm cluster create ^
    --credentials=username=admin,password=Password-5up3r53cr3t ^
    --cloud-type=AWS ^
    --cluster-type=GEO_PARTITIONED ^
    --node-config=num-cores=4,disk-size-gb=200 ^
    --region-info=region=ap-south-1,num-nodes=3,vpc=vpc-ap-south-1 ^
    --region-info=region=ap-southeast-1,num-nodes=3,vpc=vpc-ap-southeast-1 ^
    --region-info=region=ap-southeast-2,num-nodes=3,vpc=ap-southeast-2 ^
    --cluster-tier=Dedicated ^
    --fault-tolerance=REGION ^
    --database-version=Preview ^
    --wait ^
    --cluster-name=my-multi-region

Enter fullscreen mode Exit fullscreen mode

Image description

Any Platform

YBM CLI is available for all platforms. The first argument of ybm is the object and the second argument is the verb. Check ybm completion to setup auto-completion. This is the first version, it will evolve, all that is available in the GUI is available in the CLI.

Top comments (0)