Skip to content

Tagging

Use tags to organize, filter, and manage your targets effectively.

Tags are key-value pairs attached to targets for organization and filtering:

target: web-prod-01
tags:
role: web
region: us-east-1
tier: frontend
team: platform
ComponentDescriptionExample
KeyCategory namerole, region, team
ValueSpecific valueweb, us-east-1, platform
RuleGoodBad
Lowercase keysroleRole, ROLE
Alphanumericteam_nameteam-name!
Descriptivedeployment_groupdg
No spacesdata_centerdata center
┌─────────────────────────────────────────────────────────────┐
│ Target: web-prod-01 │
├─────────────────────────────────────────────────────────────┤
│ │
│ Tags: │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ role │ web │ [×] │ │
│ │ region │ us-east-1 │ [×] │ │
│ │ tier │ frontend │ [×] │ │
│ └───────────────────────────────────────────────────────┘ │
│ │
│ Add Tag: │
│ Key: [team_____________] Value: [platform_________] │
│ [Add Tag] │
│ │
└─────────────────────────────────────────────────────────────┘

Tags are created once, then attached to targets by tag ID. Tag management is performed in Lens or via the REST API (there is no mantisctl tag subcommand).

Terminal window
# Attach one or more existing tags to a target
curl -X POST "$MANTIS_URL/api/v1/targets/<target-id>/tags" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"tag_ids": ["<role-web-tag-id>", "<region-tag-id>"]}'

Click the [×] next to any tag to remove it.

Terminal window
# Detach one or more tags from a target
curl -X DELETE "$MANTIS_URL/api/v1/targets/<target-id>/tags" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"tag_ids": ["<role-web-tag-id>"]}'
Tag KeyPurposeExample Values
roleServer functionweb, api, worker, db, cache
environmentDeploy environmentdevelopment, staging, production
regionGeographic locationus-east-1, eu-west-1, ap-south-1
tierApplication tierfrontend, backend, data
teamOwning teamplatform, payments, auth
serviceService nameuser-api, order-service
cost_centerBilling allocationengineering, operations

Web Server:

role: web
tier: frontend
region: us-east-1
team: platform

Database Server:

role: database
tier: data
db_type: postgresql
replication: primary

Worker Node:

role: worker
queue: high-priority
service: order-processor

GET /api/v1/targets returns each target with its tags, so you can filter client-side (the list endpoint has no tag query parameter). Tag filtering is not available in the Lens UI; use the jq client-side approach below.

Terminal window
# List targets tagged role=web
curl "$MANTIS_URL/api/v1/targets" -H "Authorization: Bearer $TOKEN" | \
jq '.data[] | select(.tags[] | .key == "role" and .value == "web")'

Deploy to targets matching tag criteria with --target-tag (repeatable):

Terminal window
mantisctl deployment create --solution-id customer-portal \
--source-version 1.3.0 \
--target-tag role=web \
--target-tag region=us-east-1
Phase 1: Deploy to tag:canary=true
Phase 2: Deploy to tag:region=us-east-1
Phase 3: Deploy to tag:region=us-west-2
Phase 4: Deploy to tag:region=eu-west-1

Tags: team=platform, team=payments, team=auth

Tags: environment=production, environment=staging, environment=development

service=user-api:
- user-api-01
- user-api-02
service=order-service:
- order-svc-01
- order-svc-02
service=payment-gateway:
- payment-01
- payment-02

Define standard tags before deployment:

## Required Tags
All targets MUST have:
- role: Server function (web, api, worker, db)
- environment: Environment name (from Mantis environments)
- team: Owning team
## Optional Tags
- region: Geographic region
- service: Service/application name
- cost_center: For billing
- maintenance_window: Preferred maintenance time
Instead ofUse
prod, production, prdproduction
US-East-1, us_east_1us-east-1
WebServer, web-serverweb

Keep tags meaningful:

GoodAvoid
role=webis_web_server=true
team=platformmanaged_by_platform_team=yes
tier=frontendtier=frontend_presentation_layer

Maintain documentation of tag meanings:

TagValuesDescription
roleweb, api, worker, dbServer’s primary function
regionus-east-1, us-west-2, etc.AWS region location
tierfrontend, backend, dataApplication architecture tier

Review tags periodically:

Terminal window
# List all unique tag keys across targets
curl -s "$MANTIS_URL/api/v1/targets" -H "Authorization: Bearer $TOKEN" | \
jq -r '.data[].tags[].key' | sort | uniq
# Find targets missing a required tag key (e.g. role)
curl -s "$MANTIS_URL/api/v1/targets" -H "Authorization: Bearer $TOKEN" | \
jq '.data[] | select([.tags[].key] | index("role") | not) | .name'
# Find targets carrying a deprecated tag
curl -s "$MANTIS_URL/api/v1/targets" -H "Authorization: Bearer $TOKEN" | \
jq '.data[] | select([.tags[].key] | index("deprecated")) | .name'

Cause: Invalid characters in key or value

Solution: Use lowercase alphanumeric characters and underscores only

Cause: Tag values don’t match exactly

Solution: Check for typos, case sensitivity, extra spaces