resource-tagging — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited resource-tagging (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Apply comprehensive cloud resource tagging strategies to enable cost allocation, ownership tracking, compliance enforcement, and infrastructure automation across multi-cloud environments.
Resource tagging provides the foundational metadata layer for cloud governance. Tags enable precise cost allocation (reducing unallocated spend by up to 80%), rapid ownership identification, compliance scope definition, and automated lifecycle management. Without proper tagging, cloud costs become untrackable, security incidents lack context, and automation policies fail to target resources effectively.
Use resource tagging when:
Start with the "Big Six" required tags for all cloud resources:
| Tag | Purpose | Example Value | ||
|---|---|---|---|---|
| Name | Human-readable identifier | prod-api-server-01 | ||
| Environment | Lifecycle stage | prod \ | staging \ | dev |
| Owner | Responsible team contact | [email protected] | ||
| CostCenter | Finance code for billing | CC-1234 | ||
| Project | Business initiative | ecommerce-platform | ||
| ManagedBy | Resource creation method | terraform \ | pulumi \ | manual |
Optional tags to add based on specific needs:
web, api, database, cache)daily, weekly, none)PCI, HIPAA, SOC2)critical, high, medium, low)Choose ONE naming convention organization-wide and enforce consistently:
| Convention | Format | Example | Best For |
|---|---|---|---|
| PascalCase | CostCenter, ProjectName | AWS standard | AWS-first orgs |
| lowercase | costcenter, project | GCP labels (required) | GCP-first orgs |
| kebab-case | cost-center, project-name | Azure (case-insensitive) | Azure-first orgs |
| Namespaced | company:environment, team:owner | Multi-org tag policies | Large enterprises |
Critical: Case sensitivity varies by provider:
Environment ≠ environment)Environment = environment)environment only)environment ≠ Environment)For detailed taxonomy of all tag categories, see references/tag-taxonomy.md.
Operations-focused metadata: Name, Environment, Version, ManagedBy
Cost allocation metadata: Owner, CostCenter, Project, Department
Compliance metadata: Confidentiality, Compliance, DataClassification, SecurityZone
Lifecycle metadata: Backup, Monitoring, Schedule, AutoShutdown
Support metadata: SLA, ChangeManagement, CreatedBy, CreatedDate
Organization-specific metadata: Customer, Application, Component, Stack
| Provider | Tag Limit | Key Length | Value Length | Case Sensitive | Inheritance |
|---|---|---|---|---|---|
| AWS | 50 user-defined | 128 chars | 256 chars | Yes | Via tag policies |
| Azure | 50 pairs | 512 chars | 256 chars | No | Via Azure Policy |
| GCP | 64 labels | 63 chars | 63 chars | No | Via org policies |
| Kubernetes | Unlimited | 253 prefix + 63 name | 63 chars | Yes | Via namespace |
Apply tags automatically via Terraform/Pulumi to reduce manual errors by 95%:
# Terraform: Provider-level default tags
provider "aws" {
default_tags {
tags = {
Environment = var.environment
Owner = var.owner
CostCenter = var.cost_center
Project = var.project
ManagedBy = "terraform"
}
}
}All resources automatically inherit these tags. Resource-specific tags merge with defaults.
For complete Terraform, Pulumi, and CloudFormation examples, see examples/terraform/, examples/pulumi/, and examples/cloudformation/.
Enforce tagging at resource creation time:
AWS: Use AWS Config rules to check tag compliance (alert or deny) Azure: Use Azure Policy for tag inheritance and enforcement GCP: Use Organization Policies to restrict label values Kubernetes: Use OPA Gatekeeper or Kyverno for admission control
For enforcement implementation patterns, see references/enforcement-patterns.md.
Run regular audits (weekly recommended) to identify untagged resources:
AWS Config Query (SQL):
SELECT resourceId, resourceType, configuration.tags
WHERE resourceType IN ('AWS::EC2::Instance', 'AWS::RDS::DBInstance')
AND (configuration.tags IS NULL OR NOT configuration.tags.Environment EXISTS)Azure Resource Graph Query (KQL):
Resources
| where type in~ ('microsoft.compute/virtualmachines')
| where isnull(tags.Environment) or isnull(tags.Owner)
| project name, type, resourceGroup, tagsGCP Cloud Asset Inventory:
gcloud asset search-all-resources \
--query="NOT labels:environment OR NOT labels:owner" \
--format="table(name,assetType,labels)"For complete audit queries and scripts, see references/compliance-auditing.md and scripts/audit_tags.py.
Enable cost allocation tags to track spending by team, project, or department:
Activate cost allocation tags (up to 24 hours for activation):
# Enable cost allocation tags via Terraform
resource "aws_ce_cost_allocation_tag" "environment" {
tag_key = "Environment"
status = "Active"
}
resource "aws_ce_cost_allocation_tag" "project" {
tag_key = "Project"
status = "Active"
}Set up cost anomaly detection by tag to catch unusual spending:
resource "aws_ce_anomaly_monitor" "project_monitor" {
name = "project-cost-monitor"
monitor_type = "DIMENSIONAL"
monitor_specification = jsonencode({
Tags = {
Key = "Project"
Values = ["ecommerce", "mobile-app"]
}
})
}Group costs by tags in Azure Cost Management dashboards. Export cost data with tag breakdowns:
az consumption usage list \
--start-date 2025-12-01 \
--query "[].{Cost:pretaxCost, Project:tags.Project, Team:tags.Owner}"Export billing data to BigQuery with label breakdowns:
SELECT
labels.key AS label_key,
labels.value AS label_value,
SUM(cost) AS total_cost
FROM `project.dataset.gcp_billing_export_v1_XXXXX`
CROSS JOIN UNNEST(labels) AS labels
WHERE labels.key IN ('environment', 'project', 'costcenter')
GROUP BY label_key, label_value
ORDER BY total_cost DESCFor cost allocation implementation details, see references/cost-allocation.md.
Determine which tags to enforce at creation time:
REQUIRED (enforce with hard deny):
RECOMMENDED (soft enforcement - alert only):
OPTIONAL (no enforcement):
Enforcement methods:
Reduce manual tagging effort through automatic inheritance:
Inherit tags from AWS Organizations account hierarchy:
{
"tags": {
"Environment": {
"tag_key": {
"@@assign": "Environment"
},
"enforced_for": {
"@@assign": ["ec2:instance", "s3:bucket"]
}
}
}
}Use Azure Policy to inherit tags from resource groups:
resource "azurerm_policy_assignment" "inherit_environment" {
name = "inherit-environment-tag"
policy_definition_id = azurerm_policy_definition.inherit_tags.id
parameters = jsonencode({
tagName = { value = "Environment" }
})
}Inherit labels from folders/projects via organization policies:
resource "google_organization_policy" "require_labels" {
org_id = var.organization_id
constraint = "constraints/gcp.resourceLabels"
list_policy {
allow {
values = ["environment:prod", "environment:staging"]
}
inherit_from_parent = true
}
}Use Kyverno to auto-generate labels from namespaces:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: add-default-labels
spec:
rules:
- name: add-environment-label
match:
resources:
kinds: [Pod, Deployment]
mutate:
patchStrategicMerge:
metadata:
labels:
+(environment): "{{request.namespace}}"Problem: Multiple variations of the same tag across resources
# BAD: Tag sprawl
Environment: prod
environment: production
Env: prod
ENVIRONMENT: PRODSolution: Enforce single naming convention via IaC and tag policies
# GOOD: Consistent naming
Environment: prod # Single standard formatProblem: CLI/console-created resources missing required tags
Solution: Block untagged resource creation via Config/Policy rules, or use AWS Service Catalog/Azure Blueprints with pre-tagged templates
Problem: Tags are optional, frequently forgotten, leading to 35% unallocated spend
Solution: Use provider default tags in IaC + policy enforcement at account/subscription level
Problem: 30+ tags per resource, most unused, causing noise in cost reports
Solution: Start with "Big Six" required tags only. Add optional tags only when clear use case exists.
Problem: Tags set at creation but never updated (e.g., Owner outdated after team changes)
Solution: Run automated tag audits (weekly), use IaC to update tags programmatically, integrate with identity provider for owner updates
infrastructure-as-code: Tags applied automatically via Terraform/Pulumi modules with default_tags/stackTags
cost-optimization: Tags enable cost allocation, showback/chargeback, and budget alerts by project/team
compliance-frameworks: Tags prove PCI/HIPAA/SOC2 scope for audit trails and automated policy enforcement
security-hardening: Tags enforce security policies (e.g., public vs. internal access based on SecurityZone tag)
disaster-recovery: Tags identify resources for backup policies (e.g., Backup: daily triggers automated snapshots)
kubernetes-operations: Labels used for pod scheduling, resource quotas, network policies, and service selection
When implementing resource tagging:
| Provider | Enforcement Tool | Purpose |
|---|---|---|
| AWS | AWS Config Rules | Tag compliance monitoring + remediation |
| AWS | Tag Policies (Organizations) | Enforce tags at account level |
| Azure | Azure Policy | Tag enforcement + inheritance |
| GCP | Organization Policies | Label restrictions + inheritance |
| Kubernetes | OPA Gatekeeper | Admission control for labels |
| Kubernetes | Kyverno | Auto-generate labels + validation |
| Tool | Purpose |
|---|---|
| AWS Cost Explorer | Tag-based cost analysis + anomaly detection |
| Azure Cost Management | Tag grouping + budgets |
| GCP Cloud Billing | Label-based cost breakdown |
| CloudHealth | Multi-cloud cost optimization |
| Kubecost | Kubernetes cost allocation by labels |
| Tool | Purpose |
|---|---|
| Checkov | IaC tag validation (pre-commit) |
| tflint | Terraform linting for tag rules |
| terraform-compliance | BDD tests for tag policies |
For detailed implementation guidance:
references/tag-taxonomy.mdreferences/enforcement-patterns.mdreferences/cost-allocation.mdreferences/compliance-auditing.mdexamples/terraform/examples/kubernetes/scripts/audit_tags.py, scripts/cost_by_tag.py~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.