$npx -y skills add ancoleman/ai-design-components --skill resource-taggingApply and enforce cloud resource tagging strategies across AWS, Azure, GCP, and Kubernetes for cost allocation, ownership tracking, compliance, and automation. Use when implementing cloud governance, optimizing costs, or automating infrastructure management.
| 1 | # Resource Tagging |
| 2 | |
| 3 | Apply comprehensive cloud resource tagging strategies to enable cost allocation, ownership tracking, compliance enforcement, and infrastructure automation across multi-cloud environments. |
| 4 | |
| 5 | ## Purpose |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | ## When to Use |
| 10 | |
| 11 | Use resource tagging when: |
| 12 | |
| 13 | - Implementing cloud governance frameworks for cost allocation and accountability |
| 14 | - Building FinOps practices requiring spend visibility by team, project, or department |
| 15 | - Enforcing compliance requirements (PCI, HIPAA, SOC2) through automated policies |
| 16 | - Setting up automated resource lifecycle management (backup, monitoring, shutdown) |
| 17 | - Managing multi-tenant or multi-project cloud environments |
| 18 | - Implementing disaster recovery and backup policies based on criticality |
| 19 | - Tracking resource ownership for security incident response |
| 20 | - Optimizing cloud costs through spend analysis and showback/chargeback |
| 21 | |
| 22 | ## Minimum Viable Tagging Strategy |
| 23 | |
| 24 | Start with the **"Big Six"** required tags for all cloud resources: |
| 25 | |
| 26 | | Tag | Purpose | Example Value | |
| 27 | |-----|---------|---------------| |
| 28 | | **Name** | Human-readable identifier | `prod-api-server-01` | |
| 29 | | **Environment** | Lifecycle stage | `prod` \| `staging` \| `dev` | |
| 30 | | **Owner** | Responsible team contact | `platform-team@company.com` | |
| 31 | | **CostCenter** | Finance code for billing | `CC-1234` | |
| 32 | | **Project** | Business initiative | `ecommerce-platform` | |
| 33 | | **ManagedBy** | Resource creation method | `terraform` \| `pulumi` \| `manual` | |
| 34 | |
| 35 | **Optional tags** to add based on specific needs: |
| 36 | |
| 37 | - **Application**: Multi-app projects requiring app-level isolation |
| 38 | - **Component**: Resource role (`web`, `api`, `database`, `cache`) |
| 39 | - **Backup**: Backup policy (`daily`, `weekly`, `none`) |
| 40 | - **Compliance**: Regulatory scope (`PCI`, `HIPAA`, `SOC2`) |
| 41 | - **SLA**: Service level (`critical`, `high`, `medium`, `low`) |
| 42 | |
| 43 | ## Tag Naming Conventions |
| 44 | |
| 45 | Choose ONE naming convention organization-wide and enforce consistently: |
| 46 | |
| 47 | | Convention | Format | Example | Best For | |
| 48 | |------------|--------|---------|----------| |
| 49 | | **PascalCase** | `CostCenter`, `ProjectName` | AWS standard | AWS-first orgs | |
| 50 | | **lowercase** | `costcenter`, `project` | GCP labels (required) | GCP-first orgs | |
| 51 | | **kebab-case** | `cost-center`, `project-name` | Azure (case-insensitive) | Azure-first orgs | |
| 52 | | **Namespaced** | `company:environment`, `team:owner` | Multi-org tag policies | Large enterprises | |
| 53 | |
| 54 | **Critical:** Case sensitivity varies by provider: |
| 55 | - **AWS**: Case-sensitive (`Environment` ≠ `environment`) |
| 56 | - **Azure**: Case-insensitive (`Environment` = `environment`) |
| 57 | - **GCP**: Lowercase required (`environment` only) |
| 58 | - **Kubernetes**: Case-sensitive (`environment` ≠ `Environment`) |
| 59 | |
| 60 | ## Tag Categories |
| 61 | |
| 62 | For detailed taxonomy of all tag categories, see `references/tag-taxonomy.md`. |
| 63 | |
| 64 | ### Technical Tags |
| 65 | Operations-focused metadata: Name, Environment, Version, ManagedBy |
| 66 | |
| 67 | ### Business Tags |
| 68 | Cost allocation metadata: Owner, CostCenter, Project, Department |
| 69 | |
| 70 | ### Security Tags |
| 71 | Compliance metadata: Confidentiality, Compliance, DataClassification, SecurityZone |
| 72 | |
| 73 | ### Automation Tags |
| 74 | Lifecycle metadata: Backup, Monitoring, Schedule, AutoShutdown |
| 75 | |
| 76 | ### Operational Tags |
| 77 | Support metadata: SLA, ChangeManagement, CreatedBy, CreatedDate |
| 78 | |
| 79 | ### Custom Tags |
| 80 | Organization-specific metadata: Customer, Application, Component, Stack |
| 81 | |
| 82 | ## Cloud Provider Tag Limits |
| 83 | |
| 84 | | Provider | Tag Limit | Key Length | Value Length | Case Sensitive | Inheritance | |
| 85 | |----------|-----------|------------|--------------|----------------|-------------| |
| 86 | | **AWS** | 50 user-defined | 128 chars | 256 chars | Yes | Via tag policies | |
| 87 | | **Azure** | 50 pairs | 512 chars | 256 chars | No | Via Azure Policy | |
| 88 | | **GCP** | 64 labels | 63 chars | 63 chars | No | Via org policies | |
| 89 | | **Kubernetes** | Unlimited | 253 prefix + 63 name | 63 chars | Yes | Via namespace | |
| 90 | |
| 91 | ## Tag Enforcement Patterns |
| 92 | |
| 93 | ### Infrastructure as Code (Recommended) |
| 94 | |
| 95 | Apply tags automatically via Terraform/Pulumi to reduce manual errors by 95%: |
| 96 | |
| 97 | ```hcl |
| 98 | # Terraform: Provider-level default tags |
| 99 | provider "aws" { |
| 100 | default_tags { |
| 101 | tags = { |
| 102 | Environment = var.environment |
| 103 | Owner = var.owner |
| 104 | CostCenter = var.cost_center |
| 105 | Project = var.project |
| 106 | ManagedBy = "terraform" |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | ``` |
| 111 | |
| 112 | All resources automatically inherit these tags. Resource-speci |