Recently here at Cockroach Labs, we released a CLI (Command Line Interface) tool called "ccloud", this tool allows users to create, manage and connect to CockroachDB clusters that are hosted within our cloud offering, wether that be dedicated or serverless, and it's really simple to use! In this blog I will demonstrate how to build a custom multi-region dedicated cluster to fit any required specification using the new ccloud cli tool, but first of all, why are CLI tools so important and beneficial?
CLI binaries are important because they allow users to interact with a computer system through a text-based interface, which can be much faster and more efficient than a graphical user interface (GUI) for certain tasks, they are lightweight and flexible in terms of where they can be used.
Additionally, CLI binaries provide a more flexible and customizable interface than GUIs. Users can combine multiple commands and utilities to perform complex tasks and create custom workflows tailored to their specific needs, as well as being able to write custom scripting in order to leverage the CLI.
Overall, CLI binaries are a great tool system administrators and developers, who need to interact with a computer system efficiently and customise its behaviour to meet their needs.
Let's get started with CockroachDBs ccloud CLI!
First of all, you're going to need an account for Cockroach Cloud, fortunately, it's really simple to sign up, head on over to https://cockroachlabs.cloud/ and hit the sign up button.
Once an account is created, you'll want to go ahead and grab the relevant binary for your Architecture/OS or if using a Mac you can install using a simple brew install command, in this example I'm going to use Homebrew in my terminal window.
brew install cockroachdb/tap/ccloud
Once installed you can validate it's success by simply typing the below in to the command line.
Before we can go ahead and create Cockroach Cloud resources, we must authenticate so that we can access and manage resources, luckily enough ccloud makes this really easy and has a variety of options for logging in, the most simple way to do this is by simply typing the below command and logging in via your browser.
cccloud auth login
Now at this point we could just run the quickstart, which I'll link to later on in the blog, but what happens say if we wanted to create a custom multi region dedicated cluster in AWS using our own parameters? Well.... turns out, that's pretty easy too!
Let's create an AWS Dedicated cluster named ccloud-demo in eu-west-1, eu-west-2 and eu-central-1. I have picked 3 regions as best practice for multi-region deployments, although the CLI will allow entering 2 regions, I would not recommend doing so for production workload.
We will also need to specify how many nodes we want in each region, how many vCPU's and how much storage each of the nodes should have (we don't need to specify memory as they're attached to the vCPU size), bringing all of this together the command will look like the below:
ccloud cluster create dedicated dansheldon-ccloud-blog eu-west-1:3 eu-west-2:3 eu-central-1:3 --cloud AWS --vcpus 2 --storage-gib 50
The format of this command is simply <cluster type> <name> <region:nodecount> and then the flags for cloud, cpu and storage, it's really that simple! Upon running this command you should be presented with a successful message output.
Now although this says the cluster has been created, note that it takes around 30 minutes for a dedicated cluster to finish provisioning, you can monitor it's progress and check the cli has triggered it's launch by simply checking in the Cloud UI.
As we can see from the image above, I have a 9 node, 3 region AWS cluster in a provisioning state, and it only took one simple command to get going!
Hopefully this post provides you with the insight required to get started with ccloud yourselves, if you'd like to understand more about the quick start feature of ccloud cli or perhaps some of the more advanced features such as managing IP allowlists head over to https://www.cockroachlabs.com/docs/cockroachcloud/ccloud-get-started.html
Thank you for reading.