A server's hostname is set at deploy and does not change. Labels and tags sit on top of it. A label is a free-text name for people, such as "Production API". Tags are short keywords for filtering and for scripts, such as prod, eu and api.
Label or tags?
| Label | Tags | |
|---|---|---|
| Example | Production API | prod, eu, api |
| Limit | 80 characters | 10 tags |
| Allowed characters | Anything | Lowercase letters, digits, - and _ |
| Set at deploy | Yes, in step 5 of the deploy form | No, on the Settings tab afterwards |
| In the Servers list | Shown under the server name | Not shown, but matched by the filter |
| In the API | label |
tags, as a list |
Set a label and tags
- Open the server and its Settings tab.
- In the Label and tags card, type a Label.
- Type your Tags, separated by commas.
- Click Save. The message "Saved." confirms it.
Tags are cleaned up when you save. They are lowercased, any character other than a letter, a digit, a hyphen or an underscore is removed, empty entries are dropped, and only the first 10 are kept. For example, Prod, EU-West, web server becomes prod, eu-west and webserver.
To remove the label or the tags, empty the field and click Save.
Find servers by label or tag
- On the Servers page, type in Filter by name, IP, region…. The filter matches the server name, label, IP address, city, region code, tags and image name, so typing
prodkeeps every server taggedprod. - The console search (Ctrl K) also matches tags, along with the name, label, IPv4 and IPv6 addresses and server ID. Each server result shows its label (or name), IPv4 address, region and tags.
Use them from the API
Each server returned by GET /api/v1/servers carries its label and its tags. You can set a label when you create a server through the API; tags are set on the Settings tab. This prints the IPv4 address of every server tagged prod:
curl -s https://cloudsat.io/api/v1/servers -H "Authorization: Bearer $CLOUDSAT_TOKEN" \
| jq -r '.servers[] | select(.tags | index("prod")) | .ipv4'
A read-only token is enough for this (Create and use API tokens, API reference).
A simple scheme that scales
- One tag for the environment:
prod,staging,dev. - One for the role:
web,db,worker,vpn. - One for the region, or for the client if you run servers for others:
eu,us,acme. - The label for what a person needs at a glance, such as who owns the server or what it runs.
Keep tags short and stick to the scheme: a filter only finds what was typed the same way.