Aller au contenu principal
Version : v1.1.4

Example: FinOps cost-allocation tags

Goal: a report for the FinOps (cloud financial operations) or finance team that shows, per resource, whether the cost-allocation tags are present and valid.

You need: read-only credentials. Tags only appear in AWS cost reports after you activate them as cost allocation tags in the AWS Billing and Cost Management console. InvenTag shows which resources carry them; it does not calculate costs.

Template​

finops-cost-report (a report template) shows CostCenter, Owner, Project and Environment as columns and turns on the finops-cost-allocation tag policy:

Tag keyRule in finops-cost-allocation
CostCenterCC- and four digits, for example CC-1234
OwnerAny value
ProjectAny value
Environmentprod, staging, dev, test or sandbox

If your cost centres look different, adapt the policy and keep the report:

.inventag/templates/our-cost-tags.yaml
format_version: 1
kind: tag-policy
name: our-cost-tags
description: Our cost centres are five-digit numbers
extends: finops-cost-allocation
spec:
required_tags:
- key: CostCenter
pattern: "[0-9]{5}"

Command​

Terminal
inventag --template finops-cost-report --create-excel --create-word --account-regions us-east-1
# with your own policy:
inventag --template finops-cost-report --template our-cost-tags --create-excel

Output​

Terminal
inventag - WARNING - - No account specification method provided. Using default AWS credentials.
Wrote bom_output/tag_compliance_20261112_090000.json
Wrote bom_output/multi_account_bom_20261112_090000.docx
Wrote bom_output/multi_account_bom_20261112_090000.xlsx
Tag policy 'finops-cost-allocation': 1 of 22 resources compliant (4.5%), 21 non-compliant, 14 out of scope.

Sheets: Summary, DYNAMODB, EC2, EVENTS, IAM, KMS, LAMBDA, S3, VPC, Tag Compliance

Tag Compliance sheet, first rows:

AccountRegionServiceTypeResourceARNStatusMissing tagsProblems
123456789012us-east-1DYNAMODBTableacme-ordersarn:aws:dynamodb:us-east-1:123456789012:table...Non-compliantCostCenter, Project
123456789012us-east-1EC2Instanceacme-web-1arn:aws:ec2:us-east-1:123456789012:instance/i...Non-compliantCostCenter, Project
123456789012us-east-1EC2Volumeacme-build-cachearn:aws:ec2:us-east-1:123456789012:volume/vol...Non-compliantCostCenter, Owner, Project, Environment
123456789012globalIAMRoleacme-orders-api-rolearn:aws:iam::123456789012:role/acme-orders-ap...Non-compliantCostCenter, Owner, Project, Environment

<img src={require("../assets/examples/img/finops-tag-compliance-sheet.png").default} alt="Tag Compliance sheet: one row per resource with account, region, service, type, resource, ARN, status, missing tags and problems, followed by the policy rules table (sample data)" width="1074" height="295" loading="lazy" />

The Word document's Tag compliance section:

Document outline:

  • Cost Allocation Tag Report (title)
  • Summary
  • Tag compliance
    • Required tags
    • Non-compliant resources
  • Resources by service
  • About this report

A table from the document:

Tag keyRuleMissingInvalid value
CostCenterMatches: CC-[0-9]{4}191
OwnerAny value160
ProjectAny value200
EnvironmentOne of: prod, staging, dev, test, sandbox (an...161

The JSON file:

tag_compliance_20261112_090000.json (one resource shown)
{
"policy": "finops-cost-allocation",
"description": "Requires CostCenter, Owner, Project and Environment so spend can be allocated.",
"summary": {
"checked": 22,
"compliant": 1,
"non_compliant": 21,
"out_of_scope": 14,
"percent_compliant": 4.5,
"missing_by_key": {
"CostCenter": 19,
"Owner": 16,
"Project": 20,
"Environment": 16
},
"invalid_by_key": {
"CostCenter": 1,
"Owner": 0,
"Project": 0,
"Environment": 1
}
},
"non_compliant_resources": [
{
"account": "123456789012",
"service": "S3",
"resource_type": "Bucket",
"resource_id": "acme-reports",
"arn": "arn:aws:s3:::acme-reports",
"region": "us-east-1",
"missing": [],
"invalid": [
"CostCenter: '1234' does not match CC-[0-9]{4}",
"Environment: 'Production' is not one of prod, staging, dev, test, sandbox"
]
}
]
}

Download the sample tag-compliance JSON (8 KB, sample data)

Next steps​

  • Send the Word document to budget owners. Its Tag compliance section lists the non-compliant resources.
  • Track progress weekly: Run InvenTag in CI/CD.