tag-governance-automator
Designs and implements AWS tag governance automation across Organizations TagPolicy JSON (allowed_values, case_sensitive, enforced_for cascade), EventBridge + Lambda auto-tagging on EC2/S3/Lambda creation (derive Owner from IAM identity, Environment from account map), Resource Groups Tagging API bulk operations (tag-resources, untag-resources, get-resources multi-region), Config required-tags managed rule + Security Hub finding aggregation, cost-allocation-tag activation via Billing API (user-defined vs AWS-generated), and ABAC IAM policy design with aws:ResourceTag and aws:PrincipalTag condition keys. Covers automated remediation: Config detects missing tag, SSM Automation adds tag, Config re-evaluates. Emits AUTOMATED with tag policy template or MANUAL_STEP_REQUIRED with the specific gap. Use when building tag governance, auto-tagging pipelines, ABAC, or tag-compliance automation.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-24
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- name
- tag-governance-automator
- license
- Apache-2.0
- metadata
- { "tags": "aws-organizations, tag-policy, resource-groups-tagging-api, aws-config, security-hub, abac, eventbridge, lambda, automate", "phase": "4", "author": "Jacky Chan — AWS Community Builder", "domain": "aws-cloudops", "family": "Governance", "version": "0.1.0", "keywords": "AWS Organizations, Tag Policy, TagPolicy, allowed_values, enforced_for, Resource Groups Tagging API, tag-resources, untag-resources, AWS Config, required-tags, Security Hub, EventBridge, Lambda auto-tagging, cost allocation tags, ABAC, aws:ResourceTag, aws:PrincipalTag, aws:RequestTag, SSM Automation, tag compliance, tag governance", "task_type": "automate", "complexity": "high", "entry_point": "false", "skill_class": "capability", "when_to_use": "Designing Organizations tag policies (allowed_values, case sensitivity, enforced_for), building EventBridge + Lambda auto-tagging pipelines, running Resource Groups Tagging API bulk operations across regions, wiring Config required-tags rules with Security Hub findings, activating cost allocation tags, designing ABAC IAM policies with aws:ResourceTag / aws:PrincipalTag conditions, or remediating untagged resources via Config + SSM Automation.", "requires_llm": "true", "verdict_shape": "AUTOMATED | MANUAL_STEP_REQUIRED", "lifecycle_status": "active", "invocation_schema": "Input: either (a) a tag governance requirement (\"enforce Environment and CostCenter tags on all EC2 and S3 resources\", \"auto-tag Owner on EC2 creation\", \"design ABAC policy for team-scoped access\"), OR (b) an existing tag policy / Config rule / EventBridge rule to audit and harden. Output: deterministic GOVERNANCE block per requirement — STRATEGY/POLICY/AUTOMATION/COMPLIANCE/VERDICT — where VERDICT is AUTOMATED (tag policy template ready) or MANUAL_STEP_REQUIRED (specific gap cited, e.g., Billing console activation that cannot be API-driven).", "supports_pipeline": "true", "activation_triggers": "design Organizations TagPolicy, allowed_values enforced_for, auto-tag on creation EventBridge Lambda, Resource Groups Tagging API bulk, tag-resources untag-resources, required-tags Config rule, cost allocation tag activation, ABAC IAM policy ResourceTag, tag compliance remediation, Security Hub tag finding, tag governance baseline" }
- description
- Designs and implements AWS tag governance automation across Organizations TagPolicy JSON (allowed_values, case_sensitive, enforced_for cascade), EventBridge + Lambda auto-tagging on EC2/S3/Lambda creation (derive Owner from IAM identity, Environment from account map), Resource Groups Tagging API bulk operations (tag-resources, untag-resources, get-resources multi-region), Config required-tags managed rule + Security Hub finding aggregation, cost-allocation-tag activation via Billing API (user-defined vs AWS-generated), and ABAC IAM policy design with aws:ResourceTag and aws:PrincipalTag condition keys. Covers automated remediation: Config detects missing tag, SSM Automation adds tag, Config re-evaluates. Emits AUTOMATED with tag policy template or MANUAL_STEP_REQUIRED with the specific gap. Use when building tag governance, auto-tagging pipelines, ABAC, or tag-compliance automation.
- compatibility
- Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline policy design. Live deployment uses aws organizations enable-policy-type, create-policy, update-policy, aws resourcegroupstaggingapi tag-resources, untag-resources, get-resources, aws configservice put-config-rule, describe-config-rules, aws ce update-cost-allocation-tags-status, aws ssm create-document, start-automation-execution, and aws lambda create-function with an...
02 资源文件 20
- 参考文档eval/test-cases.yaml6.1 KB
- 参考文档evals/baselines/abac-policy-design.md843 B
- 参考文档evals/baselines/auto-tag-on-create.md886 B
- 参考文档evals/baselines/bulk-remediation-config-ssm.md941 B
- 参考文档evals/baselines/manual-gap-billing-activation.md603 B
- 参考文档evals/baselines/tag-policy-org-baseline.md942 B
- 参考文档evals/eval_config.yaml1.7 KB
- 参考文档evals/evals.json4.2 KB
- 参考文档evals/prompts/abac-policy-design.md804 B
- 参考文档evals/prompts/auto-tag-on-create.md811 B
- 参考文档evals/prompts/bulk-remediation-config-ssm.md1.2 KB
- 参考文档evals/prompts/manual-gap-billing-activation.md983 B
- 参考文档evals/prompts/tag-policy-org-baseline.md678 B
- 参考文档examples/README.md8.1 KB
- 参考文档references/advanced-patterns.md15.0 KB
- 参考文档references/auto-tagging-eventbridge-lambda.md12.1 KB
- 参考文档references/diagnostic-commands.md2.6 KB
- 参考文档references/organizations-tag-policies.md8.4 KB
- 参考文档references/worked-examples.md4.8 KB
- 参考文档skill.usf.yaml4.6 KB
03 SKILL.md 正文
Tag Governance Automator
Mindset
One-line takeaway: tag governance is a three-layer stack — define (Organizations TagPolicy sets the rules) → enforce (EventBridge + Lambda auto-tags on creation; Config required-tags detects violations) → remediate (SSM Automation or Lambda adds missing tags; Config re-evaluates and flips COMPLIANT). A gap in ANY layer produces a silent failure: the policy is published but never enforced, resources are tagged inconsistently, cost allocation reports are wrong, and ABAC policies silently over-permit or under-permit.
- Organizations TagPolicy without
enforced_foris advisory only: the policy says Environment must beprodordev, but if no resource type is listed underenforced_for, AWS does not block non-compliant tag operations. The policy is documentation, not enforcement. - Auto-tagging without a tag policy produces drift: the Lambda stamps tags on creation, but nothing stops a human from changing them afterward. Always pair auto-tagging with a tag policy that prevents unauthorized modifications.
- Cost allocation tags are NOT active by default. A perfectly tagged fleet produces zero cost-dimension data in CUR / Cost Explorer until an administrator activates the tag keys in Billing. This is the #1 "we tagged everything and Cost Explorer is still empty" issue.
Quick navigation
| You want to... | Go to |
|---|---|
| Define required vs optional tag keys | Step 1 (tag strategy table) |
| Author Organizations TagPolicy JSON | Step 2 + Appendix A |
| Build EventBridge + Lambda auto-tagging | Step 3 + reference auto-tagging-eventbridge-lambda.md |
| Bulk tag/untag across regions via Tagging API | Step 4 |
Wire Config required-tags rule |
Step 5 |
| Route tag findings to Security Hub | Step 6 |
| Remediate missing tags automatically (Config → SSM → Config) | Step 7 |
| Activate cost allocation tags | Step 8 |
| Design ABAC IAM policies (aws:ResourceTag / aws:PrincipalTag) | Step 9 |
| Verify and audit a deployed governance baseline | Step 10 |
| Avoid common tag-policy and ABAC pitfalls | Anti-Patterns |
| Recent features (TagPolicy ABAC, CE tag-status API) | Recent AWS features |
Critical rules at a glance (do NOT bury these)
enforced_foris what makes a tag policy enforce. Without it, the policy defines allowed values but AWS does not block non-compliantCreateTags/PutBucketTagging/TagResourcecalls. A policy withallowed_valuesbut noenforced_foris a recommendation, not a guardrail. Always list the resource types explicitly.- Organizations TagPolicy
allowed_valuesmatching is case-insensitive by default. Settag_key.case_sensitive: trueif your downstream systems (CUR, ABAC conditions) depend on exact casing. A mismatch between the policy's case sensitivity and your IAMStringEqualsconditions produces silent ABAC over-grants. - Tag policies cascade: org root → OU → account → resource. A
child policy does NOT override the parent — it is additive (union of
constraints). You cannot relax a parent's
allowed_valuesat the child level. If the root says Environment isprod|dev, an OU cannot addstagingwithout editing the root policy. - Cost allocation tags require explicit activation in Billing.
Tagging a resource does NOT make the tag appear in Cost Explorer or
the Cost and Usage Report (CUR). An administrator must activate each
tag key via the Billing console or
ce update-cost-allocation-tags-status. Activation takes up to 24 hours to propagate. - ABAC condition keys are case-sensitive at the IAM evaluation layer.
aws:ResourceTag/EnvironmentwithStringEquals: "prod"does NOT match a resource taggedProd. If your tag policy allows case-insensitive values but your IAM condition usesStringEquals, you have a silent gap. UseStringEqualsIgnoreCasefor ABAC conditions OR enforce case sensitivity in the tag policy.
Pre-flight: data requirements
Designing a tag governance baseline requires these inputs:
| Input | Source | Why |
|---|---|---|
| Organization ID + root ID | aws organizations describe-organization |
Tag policy scope |
| Existing tag policies | aws organizations list-policies --filter TAG_POLICY |
Don't overwrite blindly |
| OU structure | aws organizations list-organizational-units-for-parent |
Where to attach policies |
| Account → environment mapping | Internal CMDB or account tags | Drives Environment allowed_values |
| Config recorder status | aws configservice describe-configuration-recorders |
Required-tags rule needs recorder |
| Existing Config rules | aws configservice describe-config-rules |
Avoid duplicate required-tags rules |
| Security Hub enablement | aws securityhub describe-hub |
Finding aggregation target |
| Sample resource inventory | aws resourcegroupstaggingapi get-resources |
Baseline current tag coverage |
| IAM principal tags (for ABAC) | aws iam list-user-tags / list-role-tags |
ABAC source attributes |
If the input is malformed (missing org ID, ambiguous scope), emit:
GOVERNANCE: <reference>
VERDICT: ERROR
REASON: Cannot design tag governance — Organizations root ID and target scope (resource types + accounts) are required.
GAP: Re-supply describe-organization output and the list of resource types to enforce tagging on.
Process — Workflow design (apply in order)
Step 0: Expert knowledge — non-obvious TagPolicy + tagging behaviors
Moved to references/advanced-patterns.md. Ten expert behaviors: enforcement only on enforced_for types, service:resource-type notation typos silently disable enforcement, policies block but never retro-fix, tag-resources is not atomic (check FailedResourcesMap), get-resources is region-scoped, required-tags max 5 keys, cost-tag activation is per-account, aws:PrincipalTag resolves at session creation, aws:RequestTag is create/tag-only, per-type tagging APIs need branching runbooks, system tags are not enforced.
Step 1: Define the tag strategy framework
Every governance engagement starts with a canonical tag key set. Default to this baseline and adjust per organizational requirements:
| Tag key | Category | Required? | Allowed values (example) | Purpose |
|---|---|---|---|---|
Environment |
Required | Yes | dev, staging, prod |
ABAC, cost split, blast-radius scoping |
Owner |
Required | Yes | email or team alias (free-form) | Accountability, alert routing |
Project |
Required | Yes | project code (free-form) | Cost allocation |
CostCenter |
Required | Yes | cc-1001, cc-1002, ... |
Finance reporting |
Application |
Required | Yes | app name (free-form) | Grouping, dependency mapping |
Backup:Required |
Optional | No | true, false |
Backup policy routing |
ComplianceTier |
Optional | No | tier-1, tier-2, tier-3 |
Audit cadence, SOC scope |
DataClassification |
Optional | No | public, internal, confidential |
Macie, KMS routing |
Decision rules:
- Never exceed 10 required tags — operational friction kills adoption.
- Free-form tags (
Owner,Project) are acceptable for the FIRST pass; tighten to allowed_values once the set stabilizes. - Map each tag key to a downstream consumer (Cost Explorer, ABAC, Config, Macie). A tag no consumer reads is dead weight.
Step 2: Author the Organizations TagPolicy JSON
Moved to references/organizations-tag-policies.md. Full recipe: enable-policy-type, the canonical baseline TagPolicy JSON (Environment/CostCenter/Owner/Project with case_sensitive + allowed_values + enforced_for), create-policy, attach to root/OU, negative-test enforcement, and the common-errors table (TagPolicyViolationException, silent no-enforcement, additive child limits, PolicyTypeNotEnabledException).
Step 3: Build EventBridge + Lambda auto-tagging
Moved to references/auto-tagging-eventbridge-lambda.md. Full recipe: CloudTrail → EventBridge rule (EC2 RunInstances; S3 CreateBucket + Lambda CreateFunction) → the multi-service Python handler with account→Environment mapping, plus the Lambda execution-role permissions and the EventBridge-vs-SSM trade-off table.
Step 4: Resource Groups Tagging API bulk operations
Moved to references/advanced-patterns.md. Bulk tag/untag, multi-region get-resources iteration, get-tag-keys/values, FailedResourcesMap discipline, and the Tag Editor console alternative (manual-only, never the primary mechanism).
Step 5: Wire Config required-tags managed rule
Moved to references/advanced-patterns.md. required-tags-core put-config-rule CLI (5 keys, 4 resource types), the required-tags-ext second rule for 6+ keys, and describe/get-compliance verification.
Step 6: Security Hub integration
Moved to references/advanced-patterns.md. FSBP tag controls ([EC2.26]/[S3.10]/[Lambda.3]), enable-security-hub, describe-standards-controls tag query, and the batch-import-findings custom-finding payload.
Step 7: Automated remediation (Config → SSM → Config re-evaluate)
Moved to references/worked-examples.md. Pattern A: the Custom-AddRequiredTagsEC2 SSM Automation YAML + put-remediation-configurations wiring (Automatic: false); Pattern B: EventBridge on Config NON_COMPLIANT → Lambda; placeholder remediation requires a human-correction queue.
Step 8: Activate cost allocation tags
Cost allocation tags do NOT appear in Cost Explorer or CUR until activated. Two activation paths:
Path A — API (preferred for automation):
aws ce update-cost-allocation-tags-status \
--cost-allocation-tags-status \
'[{"TagKey":"Environment","Status":"Active"},
{"TagKey":"Owner","Status":"Active"},
{"TagKey":"Project","Status":"Active"},
{"TagKey":"CostCenter","Status":"Active"}]'
Verify:
aws ce list-cost-allocation-tags \
--status Active
Path B — Billing console (fallback):
Billing console → Cost Allocation Tags → user-defined cost allocation tags
→ Activate each tag key.
User-defined vs AWS-generated tags:
| Tag source | Examples | Activation |
|---|---|---|
| User-defined | Owner, Environment, Project |
Must be activated manually |
| AWS-generated | aws:createdBy, aws:cloudformation:stack-name |
aws:createdBy is auto-active; others must be activated |
Org payer vs member accounts: in a consolidated billing family, activate tags on the payer account. The payer's cost allocation tag settings apply to the consolidated CUR. Member-account-specific tags require per-member activation for member-account-local reporting.
If the account does NOT support ce update-cost-allocation-tags-status
(legacy accounts or restricted IAM), the activation is a MANUAL step.
Flag MANUAL_STEP_REQUIRED with the Billing-console path.
Step 9: ABAC IAM policy design
Attribute-based access control uses resource and principal tags in IAM condition keys to make access decisions. ABAC scales better than RBAC for large orgs because new resources and principals inherit access from their tags — no policy edit needed.
ABAC condition keys:
| Condition key | Source | When evaluated |
|---|---|---|
aws:ResourceTag/<key> |
Resource tags | On every API call against the resource |
aws:PrincipalTag/<key> |
IAM user/role session tags | At session creation (fixed for session lifetime) |
aws:RequestTag/<key> |
Tags in the API request | On create / tag operations only |
aws:TagKeys |
List of tag keys in request | On tag operations |
ABAC policy pattern (team-scoped S3 access):
Policy JSON moved to references/worked-examples.md. Two statements: team-tag-gated object actions on team-data-* plus CreateBucket with aws:RequestTag/Team and ForAllValues aws:TagKeys allow-list.
ABAC prerequisites checklist:
- IAM principals (users / roles) are tagged with the attribute (e.g.,
Team). - Resources are tagged with the same attribute.
- The IAM policy uses
aws:ResourceTagmatchingaws:PrincipalTag. - The tag policy (Step 2) enforces that the attribute tag key exists on new resources (otherwise ABAC silently breaks for new resources).
- Session tags are passed on
AssumeRolevia--tagsor STS session tagging.
Common ABAC pitfall: StringEquals is case-sensitive. If your tag
policy allows case_sensitive: false for Environment, but your IAM
condition is StringEquals: {"aws:ResourceTag/Environment": "prod"},
a resource tagged Prod fails the check. Either enforce
case_sensitive: true in the tag policy OR use
StringEqualsIgnoreCase in the IAM condition.
Step 10: Audit and verify a deployed governance baseline
Moved to references/diagnostic-commands.md. Six verification groups: tag policy attached/enforced, Config rule evaluating, auto-tagger Lambda firing, Security Hub findings, active cost allocation tags, resource tag coverage — plus the "passes 1-3 but zero cost tags = incomplete" rule.
STRICT output contract
Every output MUST follow this exact structure. Deviations are bugs in the skill.
GOVERNANCE: <reference>
SCOPE: <accounts / OUs / regions covered>
STRATEGY:
- Required tags: <comma-separated keys>
- Optional tags: <comma-separated keys or "none">
- Enforcement layer: <Organizations TagPolicy | Config rule | both>
POLICY:
- Type: <Organizations TagPolicy | Config required-tags | EventBridge auto-tagger | ABAC IAM | conformance pack>
- Attached to: <root | OU | account | resource>
- Template: <inline JSON/YAML or "see Step N">
AUTOMATION:
- Auto-tagging: <EventBridge + Lambda | none>
- Remediation: <SSM Automation | Lambda | none>
- Trigger: <automatic | manual>
COMPLIANCE:
- Detection: <Config rule name(s)>
- Reporting: <Security Hub | Config dashboard | both>
- Cost allocation: <active | inactive | pending>
VERDICT: AUTOMATED | MANUAL_STEP_REQUIRED
GAP: <if MANUAL_STEP_REQUIRED, the specific missing piece>
TEMPLATE: <full CLI snippet or policy JSON>
Worked example — AUTOMATED, full tag governance baseline
GOVERNANCE: org-tag-baseline
SCOPE: org root r-xxxx, all member accounts, us-east-1 + us-west-2
STRATEGY:
- Required tags: Environment, Owner, Project, CostCenter, Application
- Optional tags: Backup:Required, ComplianceTier, DataClassification
- Enforcement layer: Organizations TagPolicy + Config required-tags rule
POLICY:
- Type: Organizations TagPolicy + Config required-tags-core
- Attached to: root (policy), Config recorder (rule)
- Template: see Step 2 (TagPolicy JSON) + Step 5 (Config rule)
AUTOMATION:
- Auto-tagging: EventBridge + Lambda on RunInstances, CreateBucket, CreateFunction
- Remediation: SSM Automation Custom-AddRequiredTagsEC2 (manual trigger, placeholder values)
- Trigger: manual (placeholder remediation requires human correction)
COMPLIANCE:
- Detection: required-tags-core, required-tags-ext
- Reporting: Security Hub FSBP controls + Config compliance dashboard
- Cost allocation: active (Environment, Owner, Project, CostCenter via ce API)
VERDICT: AUTOMATED
GAP: None
TEMPLATE:
aws organizations create-policy --type TAG_POLICY --name baseline-tag-policy --content file://tag-policy.json
aws configservice put-config-rule --config-rule '{"ConfigRuleName":"required-tags-core","Source":{"Owner":"AWS","SourceIdentifier":"REQUIRED_TAGS"},"Scope":{"ComplianceResourceTypes":["AWS::EC2::Instance","AWS::S3::Bucket","AWS::Lambda::Function","AWS::RDS::DBInstance"]},"InputParameters":"{\"tag1Key\":\"Environment\",\"tag2Key\":\"Owner\",\"tag3Key\":\"Project\",\"tag4Key\":\"CostCenter\",\"tag5Key\":\"Application\"}"}'
aws ce update-cost-allocation-tags-status --cost-allocation-tags-status '[{"TagKey":"Environment","Status":"Active"},{"TagKey":"Owner","Status":"Active"},{"TagKey":"Project","Status":"Active"},{"TagKey":"CostCenter","Status":"Active"}]'
Worked example — MANUAL_STEP_REQUIRED, cost allocation activation on legacy account
Moved to references/worked-examples.md. Full MANUAL_STEP_REQUIRED report: legacy payer blocks ce update-cost-allocation-tags-status; Billing-console path + 24h propagation.
Anti-Patterns — NEVER do these things
-
NEVER publish a TagPolicy without
enforced_for. The policy withallowed_valuesbut noenforced_foris advisory — AWS does not block non-compliant operations. Operators assume enforcement and drift accumulates silently. -
NEVER assume tag policy child policies can override the parent. They cannot. Child OU and account policies are additive (union). To relax a parent's
allowed_values, edit the parent. A common mistake is attaching a child policy withallowed_values: ["staging"]and assuming it merges with the parent's["dev", "prod"]— it does not. The child can only further restrict. -
NEVER use
StringEqualsfor ABAC conditions when the tag policy hascase_sensitive: false. The case-insensitive tag policy allowsProdandprod; the IAM condition matches onlyprod. This produces silent under-grants (legitimate access denied) OR over-grants (aDenywithStringNotEqualssilently passes). UseStringEqualsIgnoreCasefor ABAC conditions OR enforcecase_sensitive: truein the tag policy. -
NEVER assume cost allocation tags are active by default. They are NOT. A fully tagged fleet with zero activated tag keys produces zero cost-dimension data in Cost Explorer and CUR. Always verify with
ce list-cost-allocation-tags --status Active. -
NEVER deploy a single Config
required-tagsrule for more than 5 tag keys. The managed rule silently ignores keys beyond the 5th (tag6Key...tag7Keyare not accepted parameters). Deploy multiple required-tags rules (e.g.,required-tags-core,required-tags-ext). -
NEVER assume
resourcegroupstaggingapi get-resourcesreturns global results. It is region-scoped. Querying onlyus-east-1misses resources in other regions. Iterate over all enabled regions. -
NEVER ignore
FailedResourcesMapin atag-resourcesresponse. A non-empty map means some resources were not tagged. The API call "succeeded" but the tagging is partial. Log, retry, and alert on persistent failures. -
NEVER wire auto-tagging without a tag policy. The Lambda stamps tags on creation, but nothing stops a human from modifying them afterward. Pair auto-tagging with a TagPolicy that enforces
allowed_valueson the same keys. -
NEVER set
Automatic: trueon placeholder-tag remediation (e.g.,Environment: unknown) without a downstream human-correction queue. The placeholder satisfies the Config rule but pollutes ABAC and cost reporting. Always flag placeholder remediation as a secondary manual step. -
NEVER use
aws:RequestTagin a policy governing read operations (s3:GetObject,ec2:DescribeInstances).aws:RequestTagis only present on create / tag API calls. ADenywithaws:RequestTagon a read operation silently never matches. -
NEVER assume IAM principal tags propagate to existing sessions.
aws:PrincipalTagis resolved at session creation. Changing a user'sTeamtag does not affect active sessions until they re-authenticate. Coordinate tag changes with session refresh. -
NEVER forget that Organizations TagPolicy does NOT enforce on AWS-generated tags (
aws:cloudformation:stack-name,aws:createdBy). These are system tags. User-defined policies apply only to user-supplied keys. If your ABAC depends onaws:createdBy, there is no enforcement lever — it is always present but read-only. -
NEVER deploy ABAC without tagging the IAM principals first. An ABAC policy using
aws:PrincipalTag/Teamon an untagged role silently denies all access (empty string does not match). Verify principal tags withiam list-user-tags/list-role-tagsbefore deploying the policy. -
NEVER bulk-tag resources across accounts without assuming a role in each target account. The Tagging API operates within the caller's account. A cross-account bulk-tag script requires
sts:AssumeRoleinto each member account.
Pre-flight safety checks (run before applying any tag governance CLI)
Moved to references/diagnostic-commands.md. Gates: CONFIRM prompt, back up the tag policy (no version history), sandbox-OU test before root, payer API support check, inventory principal tags before ABAC.
Appendix A — Canonical tag key reference
Moved to references/advanced-patterns.md. 12-row canonical key table: required (Environment/Owner/Project/CostCenter/Application/Team), optional (Backup:Required/ComplianceTier/DataClassification), auto (CreatedAt/CreatorARN/CreatedVia) with consumers.
Appendix B — Decision tree (which enforcement layer)
Is the requirement to PREVENT non-compliant tags at creation?
├─ Yes → Organizations TagPolicy with enforced_for (Step 2)
│ (blocks the API call; does not fix existing resources)
│
└─ No → Is the requirement to DETECT and REPORT missing tags?
├─ Yes → Config required-tags rule (Step 5) + Security Hub (Step 6)
│
└─ No → Is the requirement to AUTO-STAMP tags on creation?
├─ Yes → EventBridge + Lambda auto-tagger (Step 3)
│
└─ No → Is the requirement to REMEDIATE existing untagged resources?
├─ Yes → Config → SSM Automation / Lambda remediation (Step 7)
│
└─ No → Is the requirement to USE tags for access decisions?
├─ Yes → ABAC IAM policy (Step 9)
│
└─ No → Is the requirement for COST REPORTING?
├─ Yes → Cost allocation tag activation (Step 8)
│
└─ Default: tag strategy framework (Step 1)
Recent AWS features (2024-2026)
Moved to references/advanced-patterns.md. TagPolicy ABAC integration, ce update-cost-allocation-tags-status GA, Tagging API pagination lifts, multi required-tags rules, custom Security Hub findings, EventBridge cross-account routing, STS session tagging.
Expert heuristic: tag governance blast radius
Moved to references/advanced-patterns.md. Non-negotiable: sandbox-OU test before root; includes the why (fleet-wide CreateTags outage), five scoping techniques, the 3-phase DETECT→sandbox-ENFORCE→root-ENFORCE rollout, cost-tag and ABAC blast radius, and BLAST_RADIUS/VALIDATION_PHASE output fields.
References (load on demand)
- advanced-patterns — Step 0 expert knowledge, Step 4 Tagging API bulk ops, Step 5 Config rule, Step 6 Security Hub, Appendix A key reference, Recent AWS features, and the blast-radius expert heuristic moved from SKILL.md
- worked-examples — Step 7 remediation recipes (SSM YAML + wiring + Pattern B), the ABAC policy JSON, and the MANUAL_STEP_REQUIRED worked example moved from SKILL.md
- diagnostic-commands — Step 10 baseline audit commands and the pre-flight safety checks moved from SKILL.md
- organizations-tag-policies — now also holds the full Step 2 TagPolicy authoring recipe moved from SKILL.md
- auto-tagging-eventbridge-lambda — now also holds the full Step 3 EventBridge + Lambda auto-tagging recipe moved from SKILL.md
Domain
AWS CloudOps / Governance Automation — Tag governance, ABAC, cost allocation.
AWS documentation
- Organizations Tag Policies — https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html
- Resource Groups Tagging API — https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/overview.html
- AWS Config required-tags Rule — https://docs.aws.amazon.com/config/latest/developerguide/required-tags.html
- ABAC for AWS — https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html
- Cost Allocation Tags — https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html
- Security Hub Foundational Security Best Practices — https://docs.aws.amazon.com/securityhub/latest/userguide/fsbp-standard.html
04 同仓库更多 Skills
xray-tracing-deployer
Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL / method / service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry / ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS / EKS / Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.
wellarchitected-workload-auditor
Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.
wellarchitected-review-operator
Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer / get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.
wafv2-web-acl-deployer
Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB/API Gateway/CloudFront, or configuring CAPTCHA/Challenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.
wafv2-web-acl-auditor
Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow/bypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.
waf-rule-deployer
Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.