When working with multiple projects and multiple Cloud Services automation becomes a must. Camunda Cloud resources such as Zeebe Clusters and Camunda Operate are no different from other components such as Databases, or Message brokers, these need to be provisioned for your applications to connect with. This project allows you to connect to the Camunda Cloud Console using the Go language or a command-line tool, allowing you to create automation around when remote environments are created and destroyed. You can connect to these APIs using any language as these APIs are just REST endpoints, but if you have automated pipelines using a command-line tool might be the best fit for you.
This project provides a binary that you can download from here (Mac/Linux): https://github.com/camunda-community-hub/camunda-cloud-go-client/releases
You can also use this project as a library by importing it to your Go projects if you are using Go Modules:
“https://github.com/camunda-community-hub/camunda-cloud-go-client/tree/main/pkg/cc/client“
Big KUDOS to Matheus Cruz (@mcruzdev1) from Brazil who contributed a large part of this library and the command-line tool.
Pre-Requisites
In order to interact with Camunda Cloud, you need to have an account. You can create one here for free: https://signup.camunda.com/accounts
Once you have an account you can use the Web Console to provision new Zeebe Clusters and related components, but if you want to automate these operations you might need remote access.
To connect to these Camunda Cloud Console Management APIs you need to create a set of credentials to allow remote access to your Camunda Cloud account. You can do this from the User Profile (Top Right Corner) -> Organization Settings menu:
Then head to the Cloud API Management Tab and create a new Client Credentials:
Notice that when you create a client, the Client Secret that you will need to use is only displayed once, so make sure you save it somewhere safe. Both, the Client Id and Client Secret are needed to connect from outside Camunda Cloud.
Usage
Next, head to download the `cc-ctl` command-line tool from here: https://github.com/camunda-community-hub/camunda-cloud-go-client/releases
You can interact with your Camunda Cloud account to provision and delete Zeebe Clusters remotely. After downloading `cc-ctl` you need to export two environment variables:
$> export CC_CLIENT_ID=<YOUR CLIENT ID>
$> export CC_CLIENT_SECRET=<YOUR CLIENT SECRET>
Then, to get all the clusters that are currently created in your account you can run:
$> cc-ctl clusters get --all
Or create a new cluster with:
$> cc-ctl clusters create --default --name test
Cluster created successfully. Cluster id: 31ae8f83-82b7-4610-866b-aef805512d3b
You can check your Camunda Cloud account for the cluster:
Now, if you query again you should be able to see the cluster details from the terminal:
$> cc-ctl clusters get --all
[
{
"uuid": "6bc37540-262e-49dc-a2fb-3342f1d1d831",
"name": "test",
"channel": {
"uuid": "6bdf0d1c-3d5a-4df6-8d03-762682964d85",
"name": "Stable",
"allowedGenerations": null,
"isDefault": true,
"defaultGeneration": {
"uuid": "",
"name": ""
}
},
"generation": {
"uuid": "1f17ef06-3bea-4059-b630-5a9aed2c187a",
"name": "Zeebe 0.26.1"
},
"created": "2021-03-18T10:21:24.534Z",
"k8sContext": {
"uuid": "deadbeef-eaea-4bd3-972a-70203f150d88",
"name": "Europe West 1D",
"region": "Europe West 1",
"zone": "D"
},
"metadata": {
"uid": "c81a0bb7-a5b8-42f8-a434-22f0ed1830ab",
"creationTimestamp": "2021-03-18T06:20:09Z",
"generation": 2,
"name": "6bc37540-262e-49dc-a2fb-3342f1d1d831",
"resourceVersion": "415169362",
"selfLink": "/apis/cloud.camunda.io/v1alpha1/zeebeclusters/6bc37540-262e-49dc-a2fb-3342f1d1d831"
}
}
]
Finally, you can delete clusters by using the Cluster Id, for example:
$> cc-ctl clusters delete --id 31ae8f83-82b7-4610-866b-aef805512d3b
Cluster deleted successfully
Once again, having a binary command-line tool that can help us to automate the creation and deletion of new Zeebe Clusters and all the related components is a step forward to simplify the experience when you are dealing with more than a single Zeebe Cluster. But if you are running your workloads in Kubernetes, a more declarative approach is needed.
Sum up
This is a brand new project that we are actively creating as part of the Camunda Cloud community and we hope to join forces with community members interested in building up more functionalities to these components and libraries.
The more components are added to Camunda Cloud, the more extensions this command-line will need to support. We have created a number of issues in GitHub that you can help us with.
As this is a relatively simple and self-contained project, you are more than welcome to join us and we will happily mentor people who are willing to help.
If you find issues with your projects or if the installation instructions are not clear, please create an issue in the corresponding GitHub repository or reach out at @salaboy on Twitter or to our awesome community contributor @mcruzdev1.