A label is a pair consisting of a key and a value assigned to a certain resource. A resource may be a dedicated server, firewall, load balancer instance or Kubernetes cluster. Labels allow you to group resources and retrieve them, based on specific criteria, and can be managed via our customer portal or public API.
Generally, the label pattern looks as follows:
"<key>": "<value>"
However, a key can be specified in two ways:
"<prefix>/<name>": "<value>"
"<name>": "<value>"
The <prefix> is optional and helps to build a two-level hierarchy of labels.
A resource can have several labels, but each key must be unique
Each resource can have up to 64 labels
The servers.com/ prefix is not allowed to be used
Labels allow resources to be placed together under logical categories for a certain purpose. A few cases showing how labels can work in practice are considered below.
Let’s say you have a simple infrastructure and want to easily distinguish between testing and production servers. A set of labels may look like this:
"environment": "production"
"environment": "testing"
Now let's imagine a more complex case: you have two independent applications (app1 and app2) and a vast amount of servers distributed between frontend and backend teams. These are the labels you may use to differentiate servers:
"app1/backend": "production"
"app1/frontend": "production"
"app1/backend": "testing"
"app1/frontend": "testing"
"app2/backend": "production"
"app2/frontend": "production"
"app2/backend": "testing"
"app2/frontend": "testing"
A complex infrastructure has different groups of servers working together towards a shared purpose. For this approach, you may want to use these labels:
"purpose": "billing"
"purpose": "core"
"purpose": "database"
Labels can be assigned to a resource during its creation or any other time during its lifecycle. There are several operations that can be performed with labels:
create a new label
update an existing label
delete an existing label
retrieve a resource by label
To learn more on how to manage labels in the public API, refer to the public API documentation. As for the customer portal, everything you need to know can be found in our knowledge base, on our website.