Labels

A label is a key-value pair assigned to a resource. Resources that support labels include dedicated servers, firewalls, load balancer instances, and Kubernetes clusters. Labels allow you to group resources and retrieve them based on specific criteria, and can be managed via the public API.

Pattern

A label consists of a key and a value:

"<key>": "<value>"

A key can be specified in two ways:

  1. "<prefix>/<name>": "<value>" — with an optional prefix that enables a two-level hierarchy
  2. "<name>": "<value>" — without a prefix

The <prefix> segment is optional and helps organize labels into logical namespaces.

Limitations

  • A resource can have several labels, but each key must be unique within that resource
  • Each resource can have up to 64 labels
  • The servers.com/ prefix is reserved and not allowed to be used

Use cases

Labels allow resources to be placed together under logical categories. The following examples show how labels can work in practice.

Separate infrastructure between testing and production environments

To distinguish between testing and production servers in a simple infrastructure:

"environment": "production"
"environment": "testing"

Independent applications within one Servers.com account

For two independent applications (app1 and app2) with servers distributed between frontend and backend teams:

"app1/backend": "production"
"app1/frontend": "production"
"app1/backend": "testing"
"app1/frontend": "testing"
"app2/backend": "production"
"app2/frontend": "production"
"app2/backend": "testing"
"app2/frontend": "testing"

Purpose-based differentiation

For a complex infrastructure with different groups of servers working towards a shared purpose:

"purpose": "billing"
"purpose": "core"
"purpose": "database"

Management

Labels can be assigned to a resource during creation or at any other point in its lifecycle. The following operations are available:

  • Create a new label
  • Update an existing label
  • Delete an existing label
  • Retrieve a resource by label

To learn how to manage labels via the public API, refer to the public API documentation.

On this page