Cost Allocation Tags

The only way to answer "which team spent this?" without splitting into separate accounts. Tag the resources, then activate the tag keys in the Billing console — and they become columns you can group your bill by. The activation step is the one everybody misses.

Cách duy nhất để trả lời "team nào tiêu khoản này?" mà không phải tách account riêng. Gắn tag cho tài nguyên, rồi kích hoạt tag key trong Billing console — chúng trở thành cột để bạn nhóm hoá đơn theo đó. Bước kích hoạt là bước ai cũng quên.

Reach for it / not the right toolKhi nào dùng / khi nào không

Reach for cost allocation tagsChọn cost allocation tag

  • Showback or chargeback across teams, projects or environments that share one account.Showback hoặc chargeback theo team, project hay môi trường dùng chung một account.
  • Finding out which environment the surprise on this month's bill came from.Tìm ra môi trường nào gây bất ngờ trên hoá đơn tháng này.
  • Budgets and anomaly alerts scoped to one team's spend rather than the whole account.Budget và cảnh báo bất thường giới hạn theo chi tiêu của một team thay vì cả account.
  • You need the breakdown inside an account — separating accounts would be too heavy.Cần bóc tách bên trong một account — tách account thì quá nặng.

Not the right toolKhông phải chỗ dùng

  • A hard boundary — if teams must not touch each other's resources or bills, use separate accounts in an Organization. Tags are labels, not walls.Ranh giới cứng — nếu các team không được đụng tài nguyên hay hoá đơn của nhau, hãy dùng account riêng trong Organization. Tag là nhãn, không phải tường.
  • Grouping costs by rules that aren't a single tag — "all of these accounts plus anything tagged X" → Cost Categories.Nhóm chi phí theo quy tắc không gói trong một tag — "các account này cộng thêm mọi thứ có tag X" → Cost Categories.
  • Preventing untagged resources from being created — a tag doesn't enforce itself; that's an SCP or a Tag Policy.Ngăn tài nguyên không tag được tạo ra — tag không tự ép mình; đó là việc của SCP hoặc Tag Policy.
  • Costs that can't carry a tag at all — some data transfer, Support charges. No tag scheme reaches 100%.Chi phí không mang tag được — một số data transfer, phí Support. Không sơ đồ tag nào đạt 100%.

First — a tag is just metadataTrước hết — tag chỉ là metadata

A tag is a key/value pair you attach to a resource. Cost is only one of the things it's used for, and it's worth knowing the others because the same tag often serves several. Một tag là cặp key/value gắn lên tài nguyên. Chi phí chỉ là một trong các mục đích, và nên biết các mục đích còn lại vì cùng một tag thường phục vụ nhiều việc.

CostChi phí group the bill by CostCenter, Project, Environmentnhóm hoá đơn theo CostCenter, Project, Environment
Access control (ABAC)Kiểm soát truy cập (ABAC) IAM conditions on aws:ResourceTag — see IAM and SSOđiều kiện IAM trên aws:ResourceTag — xem IAM và SSO
Automation targetingChọn mục tiêu tự động hoá SSM Run Command and Patch Group select instances by tagSSM Run Command và Patch Group chọn instance theo tag
The rulesCác giới hạn up to 50 user tags per resource · key 128 chars, value 256 · case sensitive · aws: is reservedtối đa 50 user tag mỗi tài nguyên · key 128 ký tự, value 256 · phân biệt hoa thường · aws: là tiền tố dành riêng
Case sensitivity is not a footnotePhân biệt hoa thường không phải chuyện nhỏ Environment=Prod, environment=prod and Env=PROD are three different columns in your cost report, each holding part of the answer. This single fact is why Tag Policies and Service Catalog TagOptions exist. Environment=Prod, environment=prod và Env=PROD là ba cột khác nhau trong báo cáo chi phí, mỗi cột giữ một phần câu trả lời. Chỉ riêng điều này là lý do Tag Policy và TagOptions của Service Catalog tồn tại.

The activation gapKhoảng hụt kích hoạt

This is the whole page in one picture. A tag sitting on a resource is invisible to billing until someone activates that key. The resource is tagged, the console shows the tag, and the cost report still says "No tag key". Đây là cả trang gói trong một hình. Một tag nằm trên tài nguyên là vô hình với billing cho tới khi ai đó kích hoạt key đó. Tài nguyên có tag, console hiện tag, mà báo cáo chi phí vẫn ghi "No tag key".

Three steps: tag the resource with CostCenter equals 1234, activate the CostCenter key in the Billing console from the payer account, and roughly 24 hours later it becomes a column in Cost Explorer and the Cost and Usage Report. Below, two cost reports are compared: without activation, the entire 4200 dollars appears under No tag key; with activation, it splits into 2600 for cost centre 1234, 1300 for 5678, and 300 still untagged. 1 · Tag the resource CostCenter=1234 2 · Activate the key Billing → Cost allocation tags payer account only 3 · It becomes a column Cost Explorer · CUR · Budgets after up to 24 hours SKIPPED STEP 2 Cost Explorer · group by CostCenter No tag key $4,200 the tag is on the resource — billing simply never recorded it ACTIVATED Cost Explorer · group by CostCenter 1234 $2,600 5678 $1,300 No tag key $300 same resources · same month · same tags on them the only difference is whether the key was activated

Activation only records data from that day forward. If you discover the gap in March, February is still a blank — unless you request a backfill from the Billing console, which populates historical months.

Kích hoạt chỉ ghi dữ liệu từ ngày đó trở đi. Phát hiện ra vào tháng Ba thì tháng Hai vẫn trống — trừ khi bạn yêu cầu backfill từ Billing console để đắp lại các tháng trước.

aws: vs user:aws: so với user:

aws: — AWS generated— AWS sinh ra user: — yours— của bạn
ExamplesVí dụ aws:createdBy · aws:cloudformation:stack-name CostCenter · Environment · Owner
Who applies itAi gắn AWS, automatically at creationAWS, tự động lúc tạo you — console, CLI, IaC, Tag Editorbạn — console, CLI, IaC, Tag Editor
Can you edit / delete itSửa / xoá được không No — the aws: prefix is reservedKhông — tiền tố aws: là dành riêng yes, freelycó, thoải mái
Retroactive?Có hồi tố? No — resources created before you activated it never get itKhông — tài nguyên tạo trước khi kích hoạt sẽ không bao giờ có you can add it to old resources at any timebạn thêm vào tài nguyên cũ lúc nào cũng được
Needs activating for billingCần kích hoạt cho billing — yes, both of them —— cả hai đều cần —

Where untagged spend actually comes fromChi phí không tag thực ra đến từ đâu

Not from people forgetting. From resources created on your behalf by other resources — and tags do not travel down that chain by themselves. Không phải do người ta quên. Do tài nguyên được tạo hộ bởi tài nguyên khác — và tag không tự đi theo chuỗi đó.

A tagged EC2 instance creates an EBS volume and a snapshot, neither of which inherits the CostCenter tag. In the cost report the instance cost is attributed to cost centre 1234 while the volume and snapshot costs fall into No tag key. The fix is to set tag specifications on the launch template, enable propagate at launch on the Auto Scaling group, and copy tags in the Data Lifecycle Manager policy. EC2 instance CostCenter=1234 EBS volume no tags EBS snapshot no tags created with it created from it the cost report 1234 instance No tag key volume snapshot storage often costs more than the instance the fix: TagSpecifications on the launch template, PropagateAtLaunch on the ASG, copy tags in DLM

Storage frequently outlives and out-costs the instance that created it. An orphaned untagged volume is both a cost-attribution hole and the thing nobody deletes.

Storage thường sống lâu hơn và tốn hơn cả instance đã tạo ra nó. Một volume mồ côi không tag vừa là lỗ hổng phân bổ chi phí, vừa là thứ không ai xoá.

Making the schema stickGiữ cho sơ đồ tag không vỡ

Four different tools, each solving a different half of the problem. Knowing which one the question is asking about is most of the battle. Bốn công cụ khác nhau, mỗi cái giải một nửa khác nhau của vấn đề. Biết đề đang hỏi cái nào là đã thắng hơn nửa.

ToolCông cụ What it does about tagsNó làm gì với tag
Tag Policies
(Organizations)
Tag Policy
(Organizations)
Standardises a key: allowed values, and the exact capitalisation of the key itself. Reports non-compliance org-wide, and can block non-compliant tagging on chosen resource types. Doesn't require the tag to exist.Chuẩn hoá một key: giá trị được phép, và cách viết hoa chính xác của key. Báo cáo vi phạm toàn org, và chặn được thao tác gắn tag sai trên các loại tài nguyên đã chọn. Không bắt buộc tag phải tồn tại.
SCP with aws:RequestTagSCP với aws:RequestTag Denies creation of a resource that arrives without the required tag. This is the one that actually makes tagging mandatory.Chặn việc tạo tài nguyên nếu thiếu tag bắt buộc. Đây mới là cái thực sự khiến việc gắn tag là bắt buộc.
AWS Config — required-tagsAWS Config — required-tags Detects resources missing a tag after the fact, and can auto-remediate with an SSM runbook.Phát hiện tài nguyên thiếu tag sau khi đã tạo, và tự khắc phục bằng runbook SSM.
Service Catalog TagOptionsService Catalog TagOptions Makes the user pick from a list at launch time, so the value is right by construction — see Service Catalog.Bắt người dùng chọn từ danh sách lúc launch, nên giá trị đúng ngay từ đầu — xem Service Catalog.
Tag Policy vs SCP — the lineTag Policy và SCP — ranh giới A Tag Policy says "if you set CostCenter, it must be spelled that way and be one of these values". An SCP says "you may not create this at all unless you set CostCenter". You usually want both: the SCP makes it present, the Tag Policy makes it consistent. Tag Policy nói "nếu bạn đặt CostCenter, phải viết đúng kiểu này và thuộc các giá trị này". SCP nói "bạn không được tạo cái này trừ khi có đặt CostCenter". Thường cần cả hai: SCP làm nó xuất hiện, Tag Policy làm nó nhất quán.

Rolling it out in the right orderTriển khai theo đúng thứ tự

The order that worksThứ tự nên làm 1. Decide the schema — few keys, fixed spellings. 2. Enforce it forward with an SCP + Tag Policy so the problem stops growing. 3. Use Tag Editor to find and bulk-tag everything that already exists. 4. Activate the keys in Billing. 5. Wait a day, then group by them in Cost Explorer. Doing 4 before 3 just gives you a confident-looking report full of "No tag key". 1. Chốt sơ đồ — ít key, viết cố định. 2. Ép từ nay về sau bằng SCP + Tag Policy để vấn đề ngừng phình ra. 3. Dùng Tag Editor tìm và gắn tag hàng loạt cho những gì đã tồn tại. 4. Kích hoạt key trong Billing. 5. Đợi một ngày rồi nhóm theo chúng trong Cost Explorer. Làm bước 4 trước bước 3 thì chỉ được một báo cáo trông rất tự tin nhưng đầy "No tag key".

Where the tags show upTag hiện ra ở đâu

  • Cost Explorer — group by or filter on any activated tag key. The fastest way to answer "who spent this". Cost Explorer — nhóm theo hoặc lọc theo bất kỳ tag key đã kích hoạt. Cách nhanh nhất để trả lời "ai tiêu khoản này".
  • Cost and Usage Report (CUR) — one column per activated key, delivered to S3. Query it with Athena and visualise in QuickSight when Cost Explorer isn't enough. Cost and Usage Report (CUR) — mỗi key đã kích hoạt là một cột, đẩy vào S3. Truy vấn bằng Athena và trực quan hoá bằng QuickSight khi Cost Explorer không đủ.
  • AWS Budgets — scope a budget and its alerts to a tag, so a team gets warned about its own overspend. AWS Budgets — giới hạn budget và cảnh báo theo tag, để mỗi team được cảnh báo về phần vượt của chính mình.
  • Cost Categories — build named buckets from rules over accounts, services and tags. Use it when one tag key can't express the grouping the finance team wants. Cost Categories — tạo các nhóm có tên từ quy tắc trên account, service và tag. Dùng khi một tag key không diễn tả nổi cách nhóm mà bên tài chính muốn.

Exam reflexesPhản xạ khi thi

The question says…Đề nói… AnswerTrả lời
"Resources are tagged but the cost report shows no breakdown""Tài nguyên đã có tag nhưng báo cáo chi phí không tách" The key was never activated in Billing → Cost allocation tagsKey chưa được kích hoạt ở Billing → Cost allocation tags
"We just activated it — why is last month still blank?""Vừa kích hoạt xong — sao tháng trước vẫn trống?" Activation isn't retroactive; request a backfill, and allow up to 24 h for new dataKích hoạt không hồi tố; yêu cầu backfill, và chờ tới 24 giờ cho dữ liệu mới
"Tag hundreds of existing resources across regions""Gắn tag cho hàng trăm tài nguyên có sẵn qua nhiều region" Tag Editor (or the Resource Groups Tagging API)Tag Editor (hoặc Resource Groups Tagging API)
"Prevent launching anything without a CostCenter tag""Chặn việc tạo tài nguyên thiếu tag CostCenter" SCP with a aws:RequestTag condition — not a Tag PolicySCP với điều kiện aws:RequestTag — không phải Tag Policy
"Everyone spells the environment tag differently""Mỗi người viết tag môi trường một kiểu" Tag Policy in Organizations (values + capitalisation)Tag Policy trong Organizations (giá trị + cách viết hoa)
"EBS volume costs aren't attributed to any team""Chi phí EBS volume không thuộc về team nào" Tags don't propagate — set TagSpecifications / PropagateAtLaunchTag không lan truyền — đặt TagSpecifications / PropagateAtLaunch
"Teams must be unable to see each other's costs""Các team không được thấy chi phí của nhau" Separate accounts in an Organization — tags are labels, not boundariesAccount riêng trong Organization — tag là nhãn, không phải ranh giới