Power Up Your Productivity With YugabyteDB Managed CLI

Catalin David

For decades, researchers have been studying various aspects of design and usability, from everyday objects to computer user interfaces.

Nowadays, every company is striving to enhance user interfaces (UI) and user experience (UX). At Yugabyte we are no different; we’ve a been prioritizing UI/UX for YugabyteDB Managed (YBM). Our focus has been on understanding how new features fit into a user’s mental model, their placement in the UI, and their impact on the overall system’s complexity.

The UI has one significant limitation: it’s designed for human users, not for systems. This can make automating tasks achieved by the UI complicated. In our conversations with users, particularly developers,  we found that switching context (opening a browser, logging in, clicking through the UI) and remembering the step-by-step process to accomplish a repetitive task was unproductive. As a result, we made it our goal to enhance efficiency and save time for users working with YugabyteDB Managed.

REST API – A strong foundation

Our first step was to create a stable, versioned, easy-to-use REST API. The YugabyteDB Managed REST API allows seamless interaction with other systems and enables the development of new tooling—laying a solid foundation for the future.

We regularly added new functionality to the REST API, while still maintaining backwards compatibility. You can get a full overview and try it out on the YugabyteDB Managed REST API documentation site.

Terraform – CI/CD for the masses

We further automated the REST API to streamline DevOps processes. Many users already use some type of CI/CD pipelines to deploy applications to their preferred cloud provider, but lacked the ability to provision the database of their choice as a part of that automated process.

To solve this problem, we developed and launched a Terraform provider, which empowers customers to automate their workflows using a familiar environment.

YugabyteDB Managed CLI – Automation and Productivity For All

While the REST API and Terraform provider are powerful tools for automating processes and interacting with YugabyteDB Managed resources, they can be challenging to use. This is especially true for those who do not know what a REST API is, or, in the case of Terraform, are not familiar with the syntax, the concept of providers, or the complexities associated with that.

Enter YugabyteDB Managed CLI. As the name suggests, it is a command-line interface (CLI) designed for interacting with YugabyteDB Managed. It lowers the barrier to entry and offers a simple and intuitive way for everyone to access their Yugabyte Managed resources. For developers, it offers the best of both worlds—automation—but also let’s them stay within their IDE or familiar environment.

Power Up Productivity with YugabyteDB CLI

Notable features include:

  1. Support for multiple platforms: YugabyteDB Managed CLI is available for Mac, Windows, and Linux distributions, in both x64 and ARM64 flavors.
  2. Open source: The CLI source code is publicly available on GitHub, and we welcome contributions.
  3. Easy to install and upgrade: We support the Homebrew package manager for Mac and Linux (see below for instructions) where installations and upgrades can be managed transparently.
  4. Full documentation: YugabyteDB Managed CLI has built-in documentation, always available for all commands via a simple --help argument. Developers can explore CLI at their own pace.
  5. Auto-complete: YugabyteDB Managed CL has auto-completion available natively, for both commands and flags, so developers can be even more productive.

How You Can Get Started

YugabyteDB Managed CLI is available via Homebrew, so installing it is as easy as:

brew install yugabyte/tap/ybm

How to get started with YugabyteDB Managed CLI

If you don’t have a YugabyteDB Managed account, you can create one with a command that takes you to the signup page:

ybm signup

Once you have an account, generate an API key. With the API key you can set credentials using the auth command:

ybm auth

Once you have these set up, you can create a sandbox cluster using this command (remember to specify a database password):

ybm cluster create \
    --cluster-name first-cluster \
    --cloud-type AWS \
    --cluster-tier Sandbox \
    --region-info region=eu-central-1,num-nodes=1 \
    --wait \
    --credentials username=admin,password=<PASSWORD_HERE>

When the cluster is created, run the following commands to get the cluster status and to generate a network allow list. Then add the IP address of your current machine to it.

ybm cluster list

ybm network-allow-list create \
    --ip-addr $(curl ifconfig.me) \
    --name "ybm-cli" \
    --description "Access the cluster from the CLI"

Next, assign it to the cluster:

ybm cluster network allow-list assign \
    --cluster-name first-cluster \
    --network-allow-list ybm-cli

If you have a Linux or a Mac and have the jq and psql tools installed, you can connect to the cluster that you just created using these commands:

PGHOST=$(ybm cluster network endpoint list --cluster-name first-cluster --region eu-central-1 --accessibility PUBLIC -o json | jq --raw-output '.host')
PGUSER=admin PGPASSWORD="<PASSWORD_HERE>" psql -h $PGHOST -p 5433 -d yugabyte

For a more advanced deployment, use the command below to create a single-region, three-node cluster with Availability Zone’s fault tolerance.

ybm cluster create \
    --cloud-type=AWS \
    --cluster-type=SYNCHRONOUS \
    --node-config=num-cores=4,disk-size-gb=200 \
    --region-info=region=eu-central-1,num-nodes=3 \
    --cluster-tier=Dedicated \
    --fault-tolerance=ZONE \
    --database-version=Preview \
    --wait \
    --cluster-name=my-single-region \
    --credentials=username=admin,password=<PASSWORD_HERE>

Explore Further

For more information and practical steps, check out the CLI documentation.

We’d love to hear how you use the YugabyteDB Managed CLI. If you have improvement ideas, or want to discuss any challenges you encounter, please open an issue on the YBM CLI Github repository

Catalin David

Related Posts

Explore Distributed SQL and YugabyteDB in Depth

Discover the future of data management.
Learn at Yugabyte University
Get Started
Browse Yugabyte Docs
Explore docs
PostgreSQL For Cloud Native World
Read for Free