[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A9J0H99FYN1AS1PZKG9T6Z":3,"skill-same:01M7A9J0H99FYN1AS1PZKG9T6Z":145},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M7A9J0H99FYN1AS1PZKG9T6Z","kms-key-rotation-optimizer",null,"Optimises AWS KMS key rotation and lifecycle cost across seven dimensions: key inventory audit (orphaned keys at $1\u002Fkey\u002Fmonth, unused key detection via CloudTrail API call analysis), rotation strategy (enable automatic annual rotation on customer-managed keys — free and transparent, same key ARN), grant optimization (retire expired grants on deleted IAM principals), alias management for rotation transparency (aliases survive key changes), cross-account key usage (grant token lifecycle, shared vs per-account keys), multi-region keys for DR (replica keys cost $1\u002Fkey\u002Fmonth per region, detect unused replicas), and deletion window management (7-30 day pending deletion window, billing continues until expiry). Emits FURTHER_OPTIMIZATION_AVAILABLE, OPTIMIZED, or ALREADY_OPTIMAL. Use when reviewing KMS spend, auditing key inventory, or planning rotation strategy.","jhkchan\u002Faws-agent-skills","jhkchan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1083902?v=4","01M7A2SVQYP9GQTPTDXP5JKYQ4","Jacky Chan","01M7A2SVS117YWCTZABB75HZR1",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: kms-key-rotation-optimizer\ndescription: 'Optimises AWS KMS key rotation and lifecycle cost across seven dimensions: key inventory audit (orphaned keys at $1\u002Fkey\u002Fmonth, unused key detection via CloudTrail API call analysis), rotation strategy (enable automatic annual rotation on customer-managed keys — free and transparent, same key ARN), grant optimization (retire expired grants on deleted IAM principals), alias management for rotation transparency (aliases survive key changes), cross-account key usage (grant token lifecycle, shared vs per-account keys), multi-region keys for DR (replica keys cost $1\u002Fkey\u002Fmonth per region, detect unused replicas), and deletion window management (7-30 day pending deletion window, billing continues until expiry). Emits FURTHER_OPTIMIZATION_AVAILABLE, OPTIMIZED, or ALREADY_OPTIMAL. Use when reviewing KMS spend, auditing key inventory, or planning rotation strategy.'\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted KMS key configurations and CloudTrail API call summaries. Live-account optimization uses aws kms list-keys, aws kms describe-key, aws kms get-key-rotation-status, aws kms list-aliases, aws kms list-grants, aws kms list-resource-tags, aws cloudtrail lookup-events (Decrypt, Encrypt, GenerateDataKey), aws ce get-cost-and-usage (AWS CLI v2, SSO or key-based...\nmetadata:\n  domain: aws-cloudops\n  complexity: medium\n  requires_llm: 'true'\n  phase: '3'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Security\n  task_type: optimize\n  skill_class: capability\n  lifecycle_status: active\n  verdict_shape: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE\n  when_to_use: Optimising KMS key cost, auditing key inventory, detecting unused or orphaned keys, evaluating rotation strategy (automatic vs manual), cleaning up stale grants, analysing cross-account key usage, reviewing multi-region key replicas, or managing key deletion windows.\n  when_not_to_use: KMS key policy security auditing (use kms-key-policy-auditor), KMS key deployment (use kms-key-deployer), KMS key operational rotation execution (use kms-key-rotation-operator), or Secrets Manager rotation (use secrets-rotation-operator). This skill focuses on cost-driven optimization decisions, not security policy review or functional rotation execution.\n  activation_triggers: optimise KMS cost, KMS key inventory audit, KMS unused keys, KMS key rotation strategy, KMS grant cleanup, KMS stale grants, KMS cross-account cost, KMS multi-region keys cost, KMS key deletion window, KMS FinOps savings, reduce KMS bill, KMS orphaned keys, KMS API call analysis, KMS monthly savings estimate\n  invocation_schema: 'Input: either (a) a key identifier + live-account context, (b) a Cost Explorer KMS cost breakdown, OR (c) a CloudTrail KMS API call summary with at least 14 days of observation. Output: a deterministic TARGET\u002FVERDICT\u002FREASON\u002FRECOMMENDATION\u002FESTIMATED_SAVINGS\u002FREMEDIATION_STEPS block per key or key group, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.'\n  invocation_example: \"# Minimal valid input (offline finding classification):\\nKeyId: arn:aws:kms:us-east-1:123456789012:key\u002Fabcd-1234\\nKeyState: Enabled\\nKeyManager: CUSTOMER\\nKeySpec: SYMMETRIC_DEFAULT\\nRotationStatus: Enabled (annual)\\nAlias: alias\u002Fapp-data-encryption\\nGrants: 15 active (3 expired, not retired)\\nCloudTrail (last 30 days):\\n  - Decrypt: 50 calls\\n  - Encrypt: 20 calls\\n  - GenerateDataKey: 10 calls\\nMultiRegion: False\\nRegion: us-east-1\\nEmit the standard optimization block (TARGET, VERDICT, REASON,\\nRECOMMENDATION, ESTIMATED_SAVINGS, REMEDIATION_STEPS).\"\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: KMS, key rotation, cost optimization, customer managed keys, AWS managed keys, key lifecycle, grant management, alias management, multi-region keys, key deletion, CloudTrail, cross-account, FinOps, CloudOps, security\n  tags: kms, security, cost-optimization, finops, key-management, encryption, key-rotation\n---\n\n# KMS Key Rotation Optimizer\n\n## What this skill does\n\nTranslates a KMS key inventory into a concrete cost-optimization\nrecommendation with a dollar-denominated savings estimate. The verdict is\nthe highest-leverage action across seven dimensions — key inventory,\nrotation configuration, grant lifecycle, alias management, cross-account\nusage, multi-region replicas, and deletion window management — applied in\npriority order. Always pairs the recommendation with exact CLI commands.\n\n## Quick navigation\n\n| Section | What it covers | When to jump here |\n|---|---|---|\n| Quick start | Four headline rules and the cost formula | First read |\n| Mindset | Why key inventory reduction is the #1 lever | Understanding the approach |\n| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a key |\n| Pre-flight data gate | CloudTrail API calls, Cost Explorer, key inventory | Before any recommendation |\n| Step 0 non-obvious behaviours | Rotation transparency, grant tokens, deletion window | Edge cases |\n| Step 1 Key inventory audit | Unused key detection, orphaned key cleanup | The headline savings dimension |\n| Step 2 Rotation strategy | Automatic vs manual rotation | All customer-managed keys |\n| Step 3 Grant optimization | Stale grant cleanup, grant lifecycle | Keys with grants |\n| Step 4 Alias management | Alias-based references for rotation transparency | Keys referenced by ID |\n| Step 5 Cross-account usage | Grant token lifecycle across accounts | Shared keys |\n| Step 6 Multi-region keys | Replica key cost optimization | DR key configurations |\n| Step 7 Deletion window | 7-30 day window, pending deletion audit | Key retirement |\n| Step 8 Impact estimation | The cost formula and worked math | Every recommendation |\n| Output format | VERDICT block + worked examples | Emitting the result |\n| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |\n| Pre-flight safety checks | CONFIRM gate, key disable, data verification | Before any apply CLI |\n\n## Quick start\n\n- **Customer-managed keys cost $1\u002Fmonth each.** Every enabled key bills\n  $1\u002Fmonth regardless of usage. A key with 0 API calls in 30 days is\n  pure waste. Inventory and delete unused keys first.\n- **Cost formula (memorise this):**\n  `monthly_cost = (customer_managed_keys × $1.00)\n               + (api_calls_10k × $0.03)\n               + (multi_region_replicas × $1.00)`\n- **Automatic rotation is free and transparent.** Enabling annual\n  rotation on a customer-managed key does NOT change the key ARN, key\n  ID, or alias. The backing key material changes, but all references\n  remain valid. There is no cost for rotation itself.\n- **AWS managed keys cannot be deleted.** They are created and managed\n  by AWS services (S3, EBS, etc.) and bill $0 — but they also cannot be\n  turned off. Focus optimization on CUSTOMER-managed keys only.\n\n## Mindset\n\nFull mindset and four-principles framing moved verbatim to\n[references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n\n## Quick reference — verdict thresholds\n\n| Observation (14-30 day window) | Verdict | Recommendation |\n|---|---|---|\n| Customer-managed key with 0 Decrypt\u002FEncrypt\u002FGenerateDataKey calls in 30 days AND no resource associations | **FURTHER_OPTIMIZATION_AVAILABLE** (unused key) | Step 1 — schedule key deletion |\n| Customer-managed key with \u003C 100 API calls\u002Fmonth AND no compliance requirement for separate key | **FURTHER_OPTIMIZATION_AVAILABLE** (consolidation) | Step 1 — consolidate into a shared key |\n| Customer-managed key with rotation Disabled AND no regulatory prohibition on rotation | **FURTHER_OPTIMIZATION_AVAILABLE** (rotation) | Step 2 — enable automatic rotation |\n| Key with 5+ expired grants not retired | **FURTHER_OPTIMIZATION_AVAILABLE** (grants) | Step 3 — retire expired grants |\n| Multi-region key with replica in a region that has 0 API calls in 30 days | **FURTHER_OPTIMIZATION_AVAILABLE** (replica) | Step 6 — delete the unused replica |\n| Key in PendingDeletion state with deletion window > 7 days AND operator wants faster deletion | **FURTHER_OPTIMIZATION_AVAILABLE** (window) | Step 7 — shorten deletion window (minimum 7 days) |\n| Two or more customer-managed keys serving the same application with identical key policies | **FURTHER_OPTIMIZATION_AVAILABLE** (consolidation) | Step 1 — consolidate into one key |\n| All dimensions verified AND a change was applied and confirmed this session | **OPTIMIZED** | Emit post-state verification |\n| All keys active, rotation enabled, grants clean, no orphaned replicas | **ALREADY_OPTIMAL** | None — continue monitoring |\n\n\n## Pre-flight: data gate (run before any optimization decision)\n\nOptimization decisions are only as good as the underlying data. Pull\nthese metrics before any recommendation. Full CLI sequences are in\n`references\u002Fkms-pricing-and-lifecycle.md`.\n\n**Required data sources** (summarized — see reference for full CLI):\nNumbered data-source CLI list moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n### Data-quality short-circuits\n\n| Condition | Effect on optimization |\n|---|---|\n| `KeyState = PendingDeletion` | Key already scheduled for deletion. Report remaining window. No further optimization. |\n| `KeyState = Disabled` | Key is not billing for API calls but still bills $1\u002Fmonth. Evaluate deletion. |\n| `KeyManager = AWS` | AWS-managed key. No cost optimization available ($0\u002Fmonth). Skip. |\n| CloudTrail lookup returns 0 events in 30 days | Key is a candidate for deletion. Cross-check resource associations. |\n| CloudTrail lookup window \u003C 14 days | Extend to minimum 14 days; 30 days preferred. |\n| Key has 50+ grants | Grant bloat. Audit for expired grants to retire. |\n| Key is referenced by an S3 bucket default encryption config | Key is in use. Do NOT delete without updating bucket encryption. |\n| Key is referenced by an EBS volume | Key is in use. Do NOT delete — encrypted volumes become unreadable. |\n\n## Process — Optimization logic (apply in order)\n\n### Step 0: Non-obvious behaviours that change the recommendation\n\nThe ten non-obvious behaviours moved verbatim to\n[references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n\n### Step 1: Key inventory audit (the #1 lever)\n\nEvery customer-managed key bills $1\u002Fmonth regardless of usage volume.\nKey reduction is the highest-leverage cost action.\n\n**Unused key detection:**\nUnused-key detection procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Key consolidation:**\nKey consolidation procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Decision gate:**\n\n| API calls (30 day) | Resource associations | Verdict |\n|---|---|---|\n| 0 calls | None detected | Schedule deletion — saves $12\u002Fyear |\n| \u003C 100 calls | Decrypt-only (historical data) | Evaluate consolidation — may save $12\u002Fyear |\n| \u003C 100 calls | Active resources | Consolidate with a shared key if policy allows |\n| > 100 calls | Active resources | Keep key; evaluate other dimensions |\n\n**CRITICAL:** Before recommending deletion, verify the key does not\nencrypt any active data. Data encrypted under a deleted key is\n**permanently unrecoverable**.\n\n### Step 2: Rotation strategy optimization\n\nRotation is a compliance and security best practice, not a cost lever.\nThe optimization ensures rotation is ENABLERED where required.\n\n**Automatic rotation decision:**\n\n| Key manager | Current rotation | Recommendation |\n|---|---|---|\n| AWS managed | Enabled (automatic) | No action — rotates annually, no cost |\n| Customer managed | Enabled (annual) | No action — rotation is transparent and free |\n| Customer managed | Disabled | Enable rotation: `aws kms enable-key-rotation --key-id \u003Cid>` |\n| Customer managed | Disabled (regulatory prohibition) | Document the exception in tags |\n\n**Manual rotation evaluation:**\n- Manual rotation (create new key, re-point alias) costs $1\u002Fmonth for\n  the new key during overlap. Only justified when:\n  - Custom rotation cadence is required (e.g., quarterly)\n  - Key material compromise is suspected\n  - Compliance mandates fresh key material immediately\n- For standard annual rotation, automatic rotation is always preferred\n  (free, transparent, same ARN).\n\n### Step 3: Grant optimization\n\nGrants delegate specific permissions on a key to principals. Expired or\nstale grants accumulate and should be retired.\n\n**Grant audit:**\nGrant audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Grant hygiene rules:**\n- Grants do NOT auto-expire unless `ExpiryDate` is set at creation.\n- A grant on a deleted IAM principal persists until retired.\n- Grant retirement is idempotent and safe.\n- Grant count per key has a soft limit of ~2500. Bloat degrades key\n  policy evaluation latency.\n\n### Step 4: Alias management for rotation transparency\n\nAliases provide a stable name that survives key rotation and replacement.\nApplications should reference aliases, not key IDs or ARNs.\n\n**Alias audit:**\nAlias audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Alias optimization:**\n- An alias is free. There is no cost benefit to reducing aliases.\n- The value is operational: alias-based references allow manual key\n  rotation without code changes (just re-point the alias).\n- Multiple aliases can point to the same key (e.g., alias\u002Fprod and\n  alias\u002Fcurrent both → same key).\n- Orphaned aliases (target key deleted) should be cleaned up:\n  `aws kms delete-alias --alias-name alias\u002F\u003Cname>`\n\n### Step 5: Cross-account key usage optimization\n\nCross-account usage introduces grant token lifecycle complexity. The\ncost optimization focuses on ensuring the key is not duplicated across\naccounts unnecessarily.\n\n**Cross-account audit:**\nCross-account audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Decision: shared key vs per-account keys:**\n- A shared cross-account key costs $1\u002Fmonth total.\n- Per-account customer-managed keys cost $1\u002Fmonth per account.\n- If fine-grained isolation is required, per-account keys are justified.\n- If the data is shared anyway, a single cross-account key is cheaper.\n\n### Step 6: Multi-region key optimization\n\nMulti-region keys have a primary key and optional replica keys. Each\nreplica bills $1\u002Fmonth per region.\n\n**Multi-region audit:**\nMulti-region audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Multi-region cost:**\nMulti-region cost math moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n### Step 7: Deletion window management\n\nThe key deletion window controls how quickly a scheduled-deletion key is\npermanently removed.\n\n**Deletion window decision:**\n\n| Scenario | Window | Recommendation |\n|---|---|---|\n| Key is unused, verified no encrypted data | 7 days (minimum) | Fastest permanent deletion |\n| Key may encrypt historical data | 30 days (maximum) | Allow time for audit and re-encryption if needed |\n| Key is in PendingDeletion, operator wants to accelerate | Reduce to 7 days | `aws kms schedule-key-deletion --key-id \u003Cid> --pending-window-in-days 7` |\n\n**PendingDeletion audit:**\nPendingDeletion audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n### Step 8: Impact estimation\n\nCompute the monthly savings for each recommendation:\n\n```\ncurrent_monthly_cost =\n  (customer_managed_keys × $1.00)\n  + (api_calls_total \u002F 10000 × $0.03)\n  + (multi_region_replicas × $1.00)\n\nprojected_monthly_cost = \u003Crecalculated with proposed changes>\n\nmonthly_saving = current_monthly_cost - projected_monthly_cost\n```\n\nAlways state assumptions: key count, API call volume, multi-region\nreplica count, pricing region.\n\n### Step 9: Final verdict\n\n- Any dimension recommends a change → **FURTHER_OPTIMIZATION_AVAILABLE**.\n- All dimensions pass AND no waste detected → **ALREADY_OPTIMAL**.\n- Change applied and verified this session → **OPTIMIZED**.\n\nNever emit `FURTHER_OPTIMIZATION_AVAILABLE` without first discharging\nevery data-gate check.\n\n## Output format\n\nTemplate block moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md) —\nthe STRICT output contract below is authoritative.\n\nFull worked examples are in `references\u002Fworked-examples.md`.\n\n## STRICT output contract\n\nThe rules below are hard constraints. Violating any one produces a\nmisclassification or an arithmetic contradiction that breaks downstream\nFinOps automation. Self-check EVERY emitted block against these rules\nbefore returning the response.\n\n### Required output structure\n\nEvery response MUST be a single block using these literal labels, in this\norder. Do NOT substitute markdown headings, camelCase, or bold variants.\n\n```text\nTARGET: \u003Ckey-id or key-alias>\nVERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE\nREASON: \u003C1-2 sentences naming the recommendation and the supporting data>\nRECOMMENDATION:\n  Current: \u003Ckey\u002Fconfig description>\n  Proposed: \u003Ckey\u002Fconfig description>\n  Dimensions changed: \u003Cinventory | rotation | grants | aliases | cross_account | multi_region | deletion>\n  Dimensions checked: \u003Clist ALL seven, each ✓ (no finding) or → (finding)>\n  Confidence: \u003CHIGH\u002FMEDIUM\u002FLOW> — \u003Cone-line rationale>\nESTIMATED_SAVINGS:\n  Current monthly: $\u003Camount>    ← MUST show all subtotals\n  Projected monthly: $\u003Camount>\n  Monthly saving: $\u003Camount>     ← MUST equal Current − Projected, 2 decimals\n  Annual saving: $\u003Camount>      ← MUST equal Monthly × 12\nREMEDIATION_STEPS:\n  1. \u003Cspecific action with CLI command>\n  2. \u003Cverification step>\nCONFIRM: \u003Cconfirmation prompt text>\n```\n\n### FORBIDDEN output patterns\n\n1. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with `Monthly\n   saving: $0.00`.** If every dimension nets zero cost delta, the verdict\n   MUST be `ALREADY_OPTIMAL`. A cost-neutral security improvement (e.g.,\n   enabling rotation) is surfaced in REASON, NOT as a dollar saving.\n\n2. **NEVER show savings math that does not balance.**\n   `Current monthly − Projected monthly` MUST equal `Monthly saving`,\n   rounded to 2 decimal places.\n\n3. **NEVER emit scratch lines** (\"WAIT — recompute\", \"Hmm, let me redo\",\n   \"corrected:\") in the output. Finalize the math before emitting.\n\n4. **NEVER recommend deleting a KMS key without verifying no encrypted\n   data depends on it.** KMS key deletion is IRREVERSIBLE. Data encrypted\n   under a deleted key is permanently unrecoverable. This is the single\n   most dangerous recommendation in this skill.\n\n5. **NEVER recommend consolidating two keys that serve different\n   compliance domains.** A PCI-DSS key and a HIPAA key may have identical\n   policies but merging them violates compliance isolation requirements.\n   Check tags and compliance scope before consolidation.\n\n6. **NEVER omit a dimension from the RECOMMENDATION block.** The\n   `Dimensions checked` line MUST list all seven dimensions, each marked\n   ✓ (no finding) or → (finding).\n\n7. **NEVER round intermediate formula steps differently from the final\n   figure.** Compute at full precision, round only the displayed result.\n\n### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math\n\nEvery field below is internally consistent. Copy this shape exactly.\n\n```text\nTARGET: alias\u002Flegacy-app-encryption\nVERDICT: FURTHER_OPTIMIZATION_AVAILABLE\nREASON: Customer-managed key with 0 Decrypt, Encrypt, or GenerateDataKey\n  calls in 30 days (CloudTrail lookup). No S3 bucket default encryption,\n  no EBS volume, no RDS instance, no Secrets Manager secret references\n  this key. Key has 3 expired grants not retired. Rotation is disabled.\n  This is an orphaned key costing $1\u002Fmonth with no active workload.\nRECOMMENDATION:\n  Current: 1 customer-managed key (Enabled), rotation Disabled,\n    3 expired grants, 0 API calls\u002F30 days\n  Proposed: 0 keys (scheduled deletion), grants retired, rotation\n    enabled before deletion for compliance audit trail\n  Dimensions changed: inventory (delete) + grants (retire) + rotation\n    (enable for audit trail)\n  Dimensions checked: inventory → (delete)  rotation → (enable first)\n    grants → (retire 3)  aliases ✓ (alias exists)  cross_account ✓ (none)\n    multi_region ✓ (single region)  deletion → (schedule 7-day window)\n  Confidence: HIGH — CloudTrail confirms zero API activity for 30 days;\n    resource association audit found no encrypted resources; grant\n    audit found 3 expired grants on deleted IAM roles.\nESTIMATED_SAVINGS:\n  Current monthly: $1.00\n    key: 1 × $1.00 = $1.00\n    api: 0 calls × $0.03\u002F10K = $0.00\n  Projected monthly: $0.00\n  Monthly saving: $1.00\n    ($1.00 − $0.00 = $1.00 ✓)\n  Annual saving: $12.00\nREMEDIATION_STEPS:\n  1. Retire expired grants:\n     aws kms retire-grant --key-id \u003Ckey-id> --grant-id \u003Cgrant-1>\n     aws kms retire-grant --key-id \u003Ckey-id> --grant-id \u003Cgrant-2>\n     aws kms retire-grant --key-id \u003Ckey-id> --grant-id \u003Cgrant-3>\n  2. Enable rotation for audit trail completeness:\n     aws kms enable-key-rotation --key-id \u003Ckey-id>\n  3. Verify no encrypted resources depend on this key:\n     aws s3api list-buckets --query 'Buckets[?DefaultEncryption'\n     aws ec2 describe-volumes --query 'Volumes[?KmsKeyId==`\u003Ckey-id>`]'\n  4. Schedule key deletion (minimum 7-day window):\n     aws kms schedule-key-deletion --key-id \u003Ckey-id> --pending-window-in-days 7\n  5. Document deletion in change management system.\nCONFIRM: About to retire 3 grants, enable rotation, and schedule\n  deletion of alias\u002Flegacy-app-encryption (7-day window). Monthly saving\n  $1.00 ($12.00\u002Fyear). Key deletion is IRREVERSIBLE. Proceed? (yes\u002Fno)\n```\n\n\n**Self-check before emit:**\n- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?\n- [ ] `Monthly saving × 12 == Annual saving`?\n- [ ] All seven dimensions listed in `Dimensions checked`?\n- [ ] Every `→` dimension has a corresponding REMEDIATION_STEPS entry?\n- [ ] No scratch\u002Frecompute text in the block?\n\n## Verdict semantics\n\n| Verdict | When to emit |\n|---|---|\n| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete, savings-bearing recommendation. |\n| `OPTIMIZED` | A change was applied and verified this session; metrics confirm the new configuration. |\n| `ALREADY_OPTIMAL` | All dimensions pass (keys active, rotation enabled, grants clean, no orphaned replicas). |\n\n**Zero-savings rule:** If MONTHLY_SAVING == $0.00 for every dimension,\nverdict MUST be `ALREADY_OPTIMAL`, never `FURTHER_OPTIMIZATION_AVAILABLE`.\nException: enabling rotation is a security improvement surfaced in\nREASON, not as a dollar saving.\n\n## Anti-Patterns — NEVER (top 5)\n\n1. **NEVER recommend deleting a KMS key without verifying no encrypted\n   data depends on it.** KMS key deletion is irreversible. Data encrypted\n   under the key is permanently lost. This is the #1 most dangerous\n   recommendation. Check S3, EBS, RDS, Secrets Manager, and Lambda\n   encryption configs before any deletion recommendation.\n\n2. **NEVER recommend consolidating keys that serve different compliance\n   domains.** A PCI-DSS key and a HIPAA key with identical policies still\n   serve different audit scopes. Merging them violates isolation. Check\n   resource tags and compliance scope before consolidation.\n\n3. **NEVER recommend disabling rotation on a customer-managed key for\n   cost reasons.** Rotation is free. The only reason to disable rotation\n   is a regulatory prohibition, which should be documented — not a cost\n   decision.\n\n4. **NEVER retire a grant without verifying the grantee principal no\n   longer needs access.** Retiring a grant that an active Lambda or\n   application depends on will immediately break decryption. Check\n   CloudTrail for recent grant usage before retiring.\n\n5. **NEVER assume a key with low API call volume is unused.** Some keys\n   encrypt historical data that is rarely accessed (e.g., archived S3\n   objects). Deleting the key makes that historical data permanently\n   unrecoverable. Verify data access patterns, not just write patterns.\n\nExtended anti-patterns in `references\u002Fkms-pricing-and-lifecycle.md`.\n\n\n## Pre-flight safety checks (run before any remediation CLI)\n\n- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,\n  emit and await operator approval. Do NOT execute until confirmed.\n- **KMS key deletion is IRREVERSIBLE.** Data encrypted under the key is\n  permanently unrecoverable. This is the most dangerous operation in\n  this skill. Triple-verify no encrypted resources depend on the key.\n- **Verify resource associations before deletion.** Check S3 bucket\n  encryption, EBS volumes, RDS instances, Secrets Manager secrets,\n  Lambda environment variables, and Redshift clusters for references to\n  the key.\n- **Grant retirement breaks dependent workloads.** Before retiring a\n  grant, verify the grantee principal is not actively using the key.\n  Check CloudTrail for recent Decrypt\u002FEncrypt events under the grant.\n- **Multi-region replica deletion is per-region.** Deleting a replica\n  does not affect the primary or other replicas, but data encrypted by\n  the replica in that region becomes permanently unrecoverable.\n- **Enabling rotation is safe and non-disruptive.** The key ARN does not\n  change. No application changes are needed.\n- **Alias updates are immediate.** Re-pointing an alias from one key to\n  another takes effect instantly. Applications using the alias will\n  immediately use the new key.\n- **PendingDeletion keys cannot be used.** Once a key enters\n  PendingDeletion, Decrypt and Encrypt calls fail. Applications relying\n  on the key will break immediately.\n- **Bulk-operation limit:** Process at most 5 key deletions per batch.\n  Verify each batch before proceeding. Abort if any key is found to\n  encrypt active data.\n\n\n## References\n\n- `references\u002Fkms-pricing-and-lifecycle.md` — pricing tables, key types,\n  rotation configuration, grant lifecycle, multi-region setup, deletion\n  window management, CLI reference, anti-pattern catalog.\n- `references\u002Fworked-examples.md` — full worked examples (unused key\n  deletion, grant cleanup, multi-region replica removal, rotation\n  enablement, already-optimal, end-to-end walkthrough).\n\n## References (load on demand)\n\n- [references\u002Fkms-pricing-and-lifecycle.md](references\u002Fkms-pricing-and-lifecycle.md) — pricing tables, key types, rotation configuration, grant lifecycle, multi-region setup, deletion window management, CLI reference, anti-pattern catalog.\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — full worked examples (unused key deletion, grant cleanup, multi-region replica removal, rotation enablement, already-optimal, end-to-end walkthrough); now also the secondary worked example (rotation enablement + unused replica deletion) and the Output format template moved from SKILL.md.\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Mindset framing, configuration dependency graph, Step 0 non-obvious behaviours, expert heuristics, and Recent AWS features moved from SKILL.md.\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight data-source CLI list and the Step 1-7 audit\u002Fconsolidation\u002Fcost\u002Fdeletion procedures moved from SKILL.md.\n\n## Domain\n\nAWS CloudOps \u002F KMS Key Rotation & Lifecycle Cost Optimization & FinOps.\n\n## AWS documentation\n\n- **AWS KMS Developer Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Foverview.html\n- **KMS pricing** — https:\u002F\u002Faws.amazon.com\u002Fkms\u002Fpricing\u002F\n- **Rotating KMS keys** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Frotate-keys.html\n- **KMS grants** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Fgrants.html\n- **Multi-region keys** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Fmulti-region-keys-overview.html\n- **Deleting KMS keys** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Fdeleting-keys.html\n- **AWS CLI KMS reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fkms\u002F\n- **AWS Well-Architected Framework — Cost Optimization** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fwellarchitected\u002Flatest\u002Fcost-optimization-pillar\u002Fwelcome.html\n","# KMS Key Rotation Optimizer\n\n## What this skill does\n\nTranslates a KMS key inventory into a concrete cost-optimization\nrecommendation with a dollar-denominated savings estimate. The verdict is\nthe highest-leverage action across seven dimensions — key inventory,\nrotation configuration, grant lifecycle, alias management, cross-account\nusage, multi-region replicas, and deletion window management — applied in\npriority order. Always pairs the recommendation with exact CLI commands.\n\n## Quick navigation\n\n| Section | What it covers | When to jump here |\n|---|---|---|\n| Quick start | Four headline rules and the cost formula | First read |\n| Mindset | Why key inventory reduction is the #1 lever | Understanding the approach |\n| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a key |\n| Pre-flight data gate | CloudTrail API calls, Cost Explorer, key inventory | Before any recommendation |\n| Step 0 non-obvious behaviours | Rotation transparency, grant tokens, deletion window | Edge cases |\n| Step 1 Key inventory audit | Unused key detection, orphaned key cleanup | The headline savings dimension |\n| Step 2 Rotation strategy | Automatic vs manual rotation | All customer-managed keys |\n| Step 3 Grant optimization | Stale grant cleanup, grant lifecycle | Keys with grants |\n| Step 4 Alias management | Alias-based references for rotation transparency | Keys referenced by ID |\n| Step 5 Cross-account usage | Grant token lifecycle across accounts | Shared keys |\n| Step 6 Multi-region keys | Replica key cost optimization | DR key configurations |\n| Step 7 Deletion window | 7-30 day window, pending deletion audit | Key retirement |\n| Step 8 Impact estimation | The cost formula and worked math | Every recommendation |\n| Output format | VERDICT block + worked examples | Emitting the result |\n| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |\n| Pre-flight safety checks | CONFIRM gate, key disable, data verification | Before any apply CLI |\n\n## Quick start\n\n- **Customer-managed keys cost $1\u002Fmonth each.** Every enabled key bills\n  $1\u002Fmonth regardless of usage. A key with 0 API calls in 30 days is\n  pure waste. Inventory and delete unused keys first.\n- **Cost formula (memorise this):**\n  `monthly_cost = (customer_managed_keys × $1.00)\n               + (api_calls_10k × $0.03)\n               + (multi_region_replicas × $1.00)`\n- **Automatic rotation is free and transparent.** Enabling annual\n  rotation on a customer-managed key does NOT change the key ARN, key\n  ID, or alias. The backing key material changes, but all references\n  remain valid. There is no cost for rotation itself.\n- **AWS managed keys cannot be deleted.** They are created and managed\n  by AWS services (S3, EBS, etc.) and bill $0 — but they also cannot be\n  turned off. Focus optimization on CUSTOMER-managed keys only.\n\n## Mindset\n\nFull mindset and four-principles framing moved verbatim to\n[references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n\n## Quick reference — verdict thresholds\n\n| Observation (14-30 day window) | Verdict | Recommendation |\n|---|---|---|\n| Customer-managed key with 0 Decrypt\u002FEncrypt\u002FGenerateDataKey calls in 30 days AND no resource associations | **FURTHER_OPTIMIZATION_AVAILABLE** (unused key) | Step 1 — schedule key deletion |\n| Customer-managed key with \u003C 100 API calls\u002Fmonth AND no compliance requirement for separate key | **FURTHER_OPTIMIZATION_AVAILABLE** (consolidation) | Step 1 — consolidate into a shared key |\n| Customer-managed key with rotation Disabled AND no regulatory prohibition on rotation | **FURTHER_OPTIMIZATION_AVAILABLE** (rotation) | Step 2 — enable automatic rotation |\n| Key with 5+ expired grants not retired | **FURTHER_OPTIMIZATION_AVAILABLE** (grants) | Step 3 — retire expired grants |\n| Multi-region key with replica in a region that has 0 API calls in 30 days | **FURTHER_OPTIMIZATION_AVAILABLE** (replica) | Step 6 — delete the unused replica |\n| Key in PendingDeletion state with deletion window > 7 days AND operator wants faster deletion | **FURTHER_OPTIMIZATION_AVAILABLE** (window) | Step 7 — shorten deletion window (minimum 7 days) |\n| Two or more customer-managed keys serving the same application with identical key policies | **FURTHER_OPTIMIZATION_AVAILABLE** (consolidation) | Step 1 — consolidate into one key |\n| All dimensions verified AND a change was applied and confirmed this session | **OPTIMIZED** | Emit post-state verification |\n| All keys active, rotation enabled, grants clean, no orphaned replicas | **ALREADY_OPTIMAL** | None — continue monitoring |\n\n\n## Pre-flight: data gate (run before any optimization decision)\n\nOptimization decisions are only as good as the underlying data. Pull\nthese metrics before any recommendation. Full CLI sequences are in\n`references\u002Fkms-pricing-and-lifecycle.md`.\n\n**Required data sources** (summarized — see reference for full CLI):\nNumbered data-source CLI list moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n### Data-quality short-circuits\n\n| Condition | Effect on optimization |\n|---|---|\n| `KeyState = PendingDeletion` | Key already scheduled for deletion. Report remaining window. No further optimization. |\n| `KeyState = Disabled` | Key is not billing for API calls but still bills $1\u002Fmonth. Evaluate deletion. |\n| `KeyManager = AWS` | AWS-managed key. No cost optimization available ($0\u002Fmonth). Skip. |\n| CloudTrail lookup returns 0 events in 30 days | Key is a candidate for deletion. Cross-check resource associations. |\n| CloudTrail lookup window \u003C 14 days | Extend to minimum 14 days; 30 days preferred. |\n| Key has 50+ grants | Grant bloat. Audit for expired grants to retire. |\n| Key is referenced by an S3 bucket default encryption config | Key is in use. Do NOT delete without updating bucket encryption. |\n| Key is referenced by an EBS volume | Key is in use. Do NOT delete — encrypted volumes become unreadable. |\n\n## Process — Optimization logic (apply in order)\n\n### Step 0: Non-obvious behaviours that change the recommendation\n\nThe ten non-obvious behaviours moved verbatim to\n[references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n\n### Step 1: Key inventory audit (the #1 lever)\n\nEvery customer-managed key bills $1\u002Fmonth regardless of usage volume.\nKey reduction is the highest-leverage cost action.\n\n**Unused key detection:**\nUnused-key detection procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Key consolidation:**\nKey consolidation procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Decision gate:**\n\n| API calls (30 day) | Resource associations | Verdict |\n|---|---|---|\n| 0 calls | None detected | Schedule deletion — saves $12\u002Fyear |\n| \u003C 100 calls | Decrypt-only (historical data) | Evaluate consolidation — may save $12\u002Fyear |\n| \u003C 100 calls | Active resources | Consolidate with a shared key if policy allows |\n| > 100 calls | Active resources | Keep key; evaluate other dimensions |\n\n**CRITICAL:** Before recommending deletion, verify the key does not\nencrypt any active data. Data encrypted under a deleted key is\n**permanently unrecoverable**.\n\n### Step 2: Rotation strategy optimization\n\nRotation is a compliance and security best practice, not a cost lever.\nThe optimization ensures rotation is ENABLERED where required.\n\n**Automatic rotation decision:**\n\n| Key manager | Current rotation | Recommendation |\n|---|---|---|\n| AWS managed | Enabled (automatic) | No action — rotates annually, no cost |\n| Customer managed | Enabled (annual) | No action — rotation is transparent and free |\n| Customer managed | Disabled | Enable rotation: `aws kms enable-key-rotation --key-id \u003Cid>` |\n| Customer managed | Disabled (regulatory prohibition) | Document the exception in tags |\n\n**Manual rotation evaluation:**\n- Manual rotation (create new key, re-point alias) costs $1\u002Fmonth for\n  the new key during overlap. Only justified when:\n  - Custom rotation cadence is required (e.g., quarterly)\n  - Key material compromise is suspected\n  - Compliance mandates fresh key material immediately\n- For standard annual rotation, automatic rotation is always preferred\n  (free, transparent, same ARN).\n\n### Step 3: Grant optimization\n\nGrants delegate specific permissions on a key to principals. Expired or\nstale grants accumulate and should be retired.\n\n**Grant audit:**\nGrant audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Grant hygiene rules:**\n- Grants do NOT auto-expire unless `ExpiryDate` is set at creation.\n- A grant on a deleted IAM principal persists until retired.\n- Grant retirement is idempotent and safe.\n- Grant count per key has a soft limit of ~2500. Bloat degrades key\n  policy evaluation latency.\n\n### Step 4: Alias management for rotation transparency\n\nAliases provide a stable name that survives key rotation and replacement.\nApplications should reference aliases, not key IDs or ARNs.\n\n**Alias audit:**\nAlias audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Alias optimization:**\n- An alias is free. There is no cost benefit to reducing aliases.\n- The value is operational: alias-based references allow manual key\n  rotation without code changes (just re-point the alias).\n- Multiple aliases can point to the same key (e.g., alias\u002Fprod and\n  alias\u002Fcurrent both → same key).\n- Orphaned aliases (target key deleted) should be cleaned up:\n  `aws kms delete-alias --alias-name alias\u002F\u003Cname>`\n\n### Step 5: Cross-account key usage optimization\n\nCross-account usage introduces grant token lifecycle complexity. The\ncost optimization focuses on ensuring the key is not duplicated across\naccounts unnecessarily.\n\n**Cross-account audit:**\nCross-account audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Decision: shared key vs per-account keys:**\n- A shared cross-account key costs $1\u002Fmonth total.\n- Per-account customer-managed keys cost $1\u002Fmonth per account.\n- If fine-grained isolation is required, per-account keys are justified.\n- If the data is shared anyway, a single cross-account key is cheaper.\n\n### Step 6: Multi-region key optimization\n\nMulti-region keys have a primary key and optional replica keys. Each\nreplica bills $1\u002Fmonth per region.\n\n**Multi-region audit:**\nMulti-region audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n**Multi-region cost:**\nMulti-region cost math moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n### Step 7: Deletion window management\n\nThe key deletion window controls how quickly a scheduled-deletion key is\npermanently removed.\n\n**Deletion window decision:**\n\n| Scenario | Window | Recommendation |\n|---|---|---|\n| Key is unused, verified no encrypted data | 7 days (minimum) | Fastest permanent deletion |\n| Key may encrypt historical data | 30 days (maximum) | Allow time for audit and re-encryption if needed |\n| Key is in PendingDeletion, operator wants to accelerate | Reduce to 7 days | `aws kms schedule-key-deletion --key-id \u003Cid> --pending-window-in-days 7` |\n\n**PendingDeletion audit:**\nPendingDeletion audit procedure moved verbatim to\n[references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n\n### Step 8: Impact estimation\n\nCompute the monthly savings for each recommendation:\n\n```\ncurrent_monthly_cost =\n  (customer_managed_keys × $1.00)\n  + (api_calls_total \u002F 10000 × $0.03)\n  + (multi_region_replicas × $1.00)\n\nprojected_monthly_cost = \u003Crecalculated with proposed changes>\n\nmonthly_saving = current_monthly_cost - projected_monthly_cost\n```\n\nAlways state assumptions: key count, API call volume, multi-region\nreplica count, pricing region.\n\n### Step 9: Final verdict\n\n- Any dimension recommends a change → **FURTHER_OPTIMIZATION_AVAILABLE**.\n- All dimensions pass AND no waste detected → **ALREADY_OPTIMAL**.\n- Change applied and verified this session → **OPTIMIZED**.\n\nNever emit `FURTHER_OPTIMIZATION_AVAILABLE` without first discharging\nevery data-gate check.\n\n## Output format\n\nTemplate block moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md) —\nthe STRICT output contract below is authoritative.\n\nFull worked examples are in `references\u002Fworked-examples.md`.\n\n## STRICT output contract\n\nThe rules below are hard constraints. Violating any one produces a\nmisclassification or an arithmetic contradiction that breaks downstream\nFinOps automation. Self-check EVERY emitted block against these rules\nbefore returning the response.\n\n### Required output structure\n\nEvery response MUST be a single block using these literal labels, in this\norder. Do NOT substitute markdown headings, camelCase, or bold variants.\n\n```text\nTARGET: \u003Ckey-id or key-alias>\nVERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE\nREASON: \u003C1-2 sentences naming the recommendation and the supporting data>\nRECOMMENDATION:\n  Current: \u003Ckey\u002Fconfig description>\n  Proposed: \u003Ckey\u002Fconfig description>\n  Dimensions changed: \u003Cinventory | rotation | grants | aliases | cross_account | multi_region | deletion>\n  Dimensions checked: \u003Clist ALL seven, each ✓ (no finding) or → (finding)>\n  Confidence: \u003CHIGH\u002FMEDIUM\u002FLOW> — \u003Cone-line rationale>\nESTIMATED_SAVINGS:\n  Current monthly: $\u003Camount>    ← MUST show all subtotals\n  Projected monthly: $\u003Camount>\n  Monthly saving: $\u003Camount>     ← MUST equal Current − Projected, 2 decimals\n  Annual saving: $\u003Camount>      ← MUST equal Monthly × 12\nREMEDIATION_STEPS:\n  1. \u003Cspecific action with CLI command>\n  2. \u003Cverification step>\nCONFIRM: \u003Cconfirmation prompt text>\n```\n\n### FORBIDDEN output patterns\n\n1. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with `Monthly\n   saving: $0.00`.** If every dimension nets zero cost delta, the verdict\n   MUST be `ALREADY_OPTIMAL`. A cost-neutral security improvement (e.g.,\n   enabling rotation) is surfaced in REASON, NOT as a dollar saving.\n\n2. **NEVER show savings math that does not balance.**\n   `Current monthly − Projected monthly` MUST equal `Monthly saving`,\n   rounded to 2 decimal places.\n\n3. **NEVER emit scratch lines** (\"WAIT — recompute\", \"Hmm, let me redo\",\n   \"corrected:\") in the output. Finalize the math before emitting.\n\n4. **NEVER recommend deleting a KMS key without verifying no encrypted\n   data depends on it.** KMS key deletion is IRREVERSIBLE. Data encrypted\n   under a deleted key is permanently unrecoverable. This is the single\n   most dangerous recommendation in this skill.\n\n5. **NEVER recommend consolidating two keys that serve different\n   compliance domains.** A PCI-DSS key and a HIPAA key may have identical\n   policies but merging them violates compliance isolation requirements.\n   Check tags and compliance scope before consolidation.\n\n6. **NEVER omit a dimension from the RECOMMENDATION block.** The\n   `Dimensions checked` line MUST list all seven dimensions, each marked\n   ✓ (no finding) or → (finding).\n\n7. **NEVER round intermediate formula steps differently from the final\n   figure.** Compute at full precision, round only the displayed result.\n\n### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math\n\nEvery field below is internally consistent. Copy this shape exactly.\n\n```text\nTARGET: alias\u002Flegacy-app-encryption\nVERDICT: FURTHER_OPTIMIZATION_AVAILABLE\nREASON: Customer-managed key with 0 Decrypt, Encrypt, or GenerateDataKey\n  calls in 30 days (CloudTrail lookup). No S3 bucket default encryption,\n  no EBS volume, no RDS instance, no Secrets Manager secret references\n  this key. Key has 3 expired grants not retired. Rotation is disabled.\n  This is an orphaned key costing $1\u002Fmonth with no active workload.\nRECOMMENDATION:\n  Current: 1 customer-managed key (Enabled), rotation Disabled,\n    3 expired grants, 0 API calls\u002F30 days\n  Proposed: 0 keys (scheduled deletion), grants retired, rotation\n    enabled before deletion for compliance audit trail\n  Dimensions changed: inventory (delete) + grants (retire) + rotation\n    (enable for audit trail)\n  Dimensions checked: inventory → (delete)  rotation → (enable first)\n    grants → (retire 3)  aliases ✓ (alias exists)  cross_account ✓ (none)\n    multi_region ✓ (single region)  deletion → (schedule 7-day window)\n  Confidence: HIGH — CloudTrail confirms zero API activity for 30 days;\n    resource association audit found no encrypted resources; grant\n    audit found 3 expired grants on deleted IAM roles.\nESTIMATED_SAVINGS:\n  Current monthly: $1.00\n    key: 1 × $1.00 = $1.00\n    api: 0 calls × $0.03\u002F10K = $0.00\n  Projected monthly: $0.00\n  Monthly saving: $1.00\n    ($1.00 − $0.00 = $1.00 ✓)\n  Annual saving: $12.00\nREMEDIATION_STEPS:\n  1. Retire expired grants:\n     aws kms retire-grant --key-id \u003Ckey-id> --grant-id \u003Cgrant-1>\n     aws kms retire-grant --key-id \u003Ckey-id> --grant-id \u003Cgrant-2>\n     aws kms retire-grant --key-id \u003Ckey-id> --grant-id \u003Cgrant-3>\n  2. Enable rotation for audit trail completeness:\n     aws kms enable-key-rotation --key-id \u003Ckey-id>\n  3. Verify no encrypted resources depend on this key:\n     aws s3api list-buckets --query 'Buckets[?DefaultEncryption'\n     aws ec2 describe-volumes --query 'Volumes[?KmsKeyId==`\u003Ckey-id>`]'\n  4. Schedule key deletion (minimum 7-day window):\n     aws kms schedule-key-deletion --key-id \u003Ckey-id> --pending-window-in-days 7\n  5. Document deletion in change management system.\nCONFIRM: About to retire 3 grants, enable rotation, and schedule\n  deletion of alias\u002Flegacy-app-encryption (7-day window). Monthly saving\n  $1.00 ($12.00\u002Fyear). Key deletion is IRREVERSIBLE. Proceed? (yes\u002Fno)\n```\n\n\n**Self-check before emit:**\n- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?\n- [ ] `Monthly saving × 12 == Annual saving`?\n- [ ] All seven dimensions listed in `Dimensions checked`?\n- [ ] Every `→` dimension has a corresponding REMEDIATION_STEPS entry?\n- [ ] No scratch\u002Frecompute text in the block?\n\n## Verdict semantics\n\n| Verdict | When to emit |\n|---|---|\n| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete, savings-bearing recommendation. |\n| `OPTIMIZED` | A change was applied and verified this session; metrics confirm the new configuration. |\n| `ALREADY_OPTIMAL` | All dimensions pass (keys active, rotation enabled, grants clean, no orphaned replicas). |\n\n**Zero-savings rule:** If MONTHLY_SAVING == $0.00 for every dimension,\nverdict MUST be `ALREADY_OPTIMAL`, never `FURTHER_OPTIMIZATION_AVAILABLE`.\nException: enabling rotation is a security improvement surfaced in\nREASON, not as a dollar saving.\n\n## Anti-Patterns — NEVER (top 5)\n\n1. **NEVER recommend deleting a KMS key without verifying no encrypted\n   data depends on it.** KMS key deletion is irreversible. Data encrypted\n   under the key is permanently lost. This is the #1 most dangerous\n   recommendation. Check S3, EBS, RDS, Secrets Manager, and Lambda\n   encryption configs before any deletion recommendation.\n\n2. **NEVER recommend consolidating keys that serve different compliance\n   domains.** A PCI-DSS key and a HIPAA key with identical policies still\n   serve different audit scopes. Merging them violates isolation. Check\n   resource tags and compliance scope before consolidation.\n\n3. **NEVER recommend disabling rotation on a customer-managed key for\n   cost reasons.** Rotation is free. The only reason to disable rotation\n   is a regulatory prohibition, which should be documented — not a cost\n   decision.\n\n4. **NEVER retire a grant without verifying the grantee principal no\n   longer needs access.** Retiring a grant that an active Lambda or\n   application depends on will immediately break decryption. Check\n   CloudTrail for recent grant usage before retiring.\n\n5. **NEVER assume a key with low API call volume is unused.** Some keys\n   encrypt historical data that is rarely accessed (e.g., archived S3\n   objects). Deleting the key makes that historical data permanently\n   unrecoverable. Verify data access patterns, not just write patterns.\n\nExtended anti-patterns in `references\u002Fkms-pricing-and-lifecycle.md`.\n\n\n## Pre-flight safety checks (run before any remediation CLI)\n\n- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,\n  emit and await operator approval. Do NOT execute until confirmed.\n- **KMS key deletion is IRREVERSIBLE.** Data encrypted under the key is\n  permanently unrecoverable. This is the most dangerous operation in\n  this skill. Triple-verify no encrypted resources depend on the key.\n- **Verify resource associations before deletion.** Check S3 bucket\n  encryption, EBS volumes, RDS instances, Secrets Manager secrets,\n  Lambda environment variables, and Redshift clusters for references to\n  the key.\n- **Grant retirement breaks dependent workloads.** Before retiring a\n  grant, verify the grantee principal is not actively using the key.\n  Check CloudTrail for recent Decrypt\u002FEncrypt events under the grant.\n- **Multi-region replica deletion is per-region.** Deleting a replica\n  does not affect the primary or other replicas, but data encrypted by\n  the replica in that region becomes permanently unrecoverable.\n- **Enabling rotation is safe and non-disruptive.** The key ARN does not\n  change. No application changes are needed.\n- **Alias updates are immediate.** Re-pointing an alias from one key to\n  another takes effect instantly. Applications using the alias will\n  immediately use the new key.\n- **PendingDeletion keys cannot be used.** Once a key enters\n  PendingDeletion, Decrypt and Encrypt calls fail. Applications relying\n  on the key will break immediately.\n- **Bulk-operation limit:** Process at most 5 key deletions per batch.\n  Verify each batch before proceeding. Abort if any key is found to\n  encrypt active data.\n\n\n## References\n\n- `references\u002Fkms-pricing-and-lifecycle.md` — pricing tables, key types,\n  rotation configuration, grant lifecycle, multi-region setup, deletion\n  window management, CLI reference, anti-pattern catalog.\n- `references\u002Fworked-examples.md` — full worked examples (unused key\n  deletion, grant cleanup, multi-region replica removal, rotation\n  enablement, already-optimal, end-to-end walkthrough).\n\n## References (load on demand)\n\n- [references\u002Fkms-pricing-and-lifecycle.md](references\u002Fkms-pricing-and-lifecycle.md) — pricing tables, key types, rotation configuration, grant lifecycle, multi-region setup, deletion window management, CLI reference, anti-pattern catalog.\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — full worked examples (unused key deletion, grant cleanup, multi-region replica removal, rotation enablement, already-optimal, end-to-end walkthrough); now also the secondary worked example (rotation enablement + unused replica deletion) and the Output format template moved from SKILL.md.\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Mindset framing, configuration dependency graph, Step 0 non-obvious behaviours, expert heuristics, and Recent AWS features moved from SKILL.md.\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight data-source CLI list and the Step 1-7 audit\u002Fconsolidation\u002Fcost\u002Fdeletion procedures moved from SKILL.md.\n\n## Domain\n\nAWS CloudOps \u002F KMS Key Rotation & Lifecycle Cost Optimization & FinOps.\n\n## AWS documentation\n\n- **AWS KMS Developer Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Foverview.html\n- **KMS pricing** — https:\u002F\u002Faws.amazon.com\u002Fkms\u002Fpricing\u002F\n- **Rotating KMS keys** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Frotate-keys.html\n- **KMS grants** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Fgrants.html\n- **Multi-region keys** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Fmulti-region-keys-overview.html\n- **Deleting KMS keys** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fkms\u002Flatest\u002Fdeveloperguide\u002Fdeleting-keys.html\n- **AWS CLI KMS reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fkms\u002F\n- **AWS Well-Architected Framework — Cost Optimization** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fwellarchitected\u002Flatest\u002Fcost-optimization-pillar\u002Fwelcome.html\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":44},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"task_type":32,"complexity":33,"entry_point":34,"skill_class":35,"when_to_use":36,"requires_llm":37,"verdict_shape":38,"when_not_to_use":39,"lifecycle_status":40,"invocation_schema":41,"supports_pipeline":37,"invocation_example":42,"activation_triggers":43},"kms, security, cost-optimization, finops, key-management, encryption, key-rotation","3","Jacky Chan — AWS Community Builder","aws-cloudops","Security","0.1.0","KMS, key rotation, cost optimization, customer managed keys, AWS managed keys, key lifecycle, grant management, alias management, multi-region keys, key deletion, CloudTrail, cross-account, FinOps, CloudOps, security","optimize","medium","false","capability","Optimising KMS key cost, auditing key inventory, detecting unused or orphaned keys, evaluating rotation strategy (automatic vs manual), cleaning up stale grants, analysing cross-account key usage, reviewing multi-region key replicas, or managing key deletion windows.","true","OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE","KMS key policy security auditing (use kms-key-policy-auditor), KMS key deployment (use kms-key-deployer), KMS key operational rotation execution (use kms-key-rotation-operator), or Secrets Manager rotation (use secrets-rotation-operator). This skill focuses on cost-driven optimization decisions, not security policy review or functional rotation execution.","active","Input: either (a) a key identifier + live-account context, (b) a Cost Explorer KMS cost breakdown, OR (c) a CloudTrail KMS API call summary with at least 14 days of observation. Output: a deterministic TARGET\u002FVERDICT\u002FREASON\u002FRECOMMENDATION\u002FESTIMATED_SAVINGS\u002FREMEDIATION_STEPS block per key or key group, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.","# Minimal valid input (offline finding classification):\nKeyId: arn:aws:kms:us-east-1:123456789012:key\u002Fabcd-1234\nKeyState: Enabled\nKeyManager: CUSTOMER\nKeySpec: SYMMETRIC_DEFAULT\nRotationStatus: Enabled (annual)\nAlias: alias\u002Fapp-data-encryption\nGrants: 15 active (3 expired, not retired)\nCloudTrail (last 30 days):\n  - Decrypt: 50 calls\n  - Encrypt: 20 calls\n  - GenerateDataKey: 10 calls\nMultiRegion: False\nRegion: us-east-1\nEmit the standard optimization block (TARGET, VERDICT, REASON,\nRECOMMENDATION, ESTIMATED_SAVINGS, REMEDIATION_STEPS).","optimise KMS cost, KMS key inventory audit, KMS unused keys, KMS key rotation strategy, KMS grant cleanup, KMS stale grants, KMS cross-account cost, KMS multi-region keys cost, KMS key deletion window, KMS FinOps savings, reduce KMS bill, KMS orphaned keys, KMS API call analysis, KMS monthly savings estimate","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted KMS key configurations and CloudTrail API call summaries. Live-account optimization uses aws kms list-keys, aws kms describe-key, aws kms get-key-rotation-status, aws kms list-aliases, aws kms list-grants, aws kms list-resource-tags, aws cloudtrail lookup-events (Decrypt, Encrypt, GenerateDataKey), aws ce get-cost-and-usage (AWS CLI v2, SSO or key-based...","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fkms-key-rotation-optimizer",0,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills","https:\u002F\u002Fgithub.com\u002Fjhkchan","CTO & Co-Founder @Beever-AI  & @votee. CAISP. AWS Community Builder. Organizer@GDGCloudHK. MongoDB Champion. Technopreneur + Infornographer.","2026-09-24 08:54:10",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill kms-key-rotation-optimizer",{"tool":59,"command":60},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill kms-key-rotation-optimizer",{"tool":62,"command":63},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill kms-key-rotation-optimizer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002FSKILL.md",true,[67,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",8665,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Feval\u002Ftest-cases.yaml",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"evals\u002Fbaselines\u002Falready-optimal-key.md",607,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fbaselines\u002Falready-optimal-key.md",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"evals\u002Fbaselines\u002Fmulti-region-replica-deletion.md",819,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fbaselines\u002Fmulti-region-replica-deletion.md",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"evals\u002Fbaselines\u002Forphaned-key-cleanup.md",698,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fbaselines\u002Forphaned-key-cleanup.md",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"evals\u002Fbaselines\u002Frotation-enablement.md",737,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fbaselines\u002Frotation-enablement.md",{"path":90,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":91,"sourceHtmlUrl":92},"evals\u002Fbaselines\u002Fstale-grant-retirement.md",676,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fbaselines\u002Fstale-grant-retirement.md",{"path":94,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":95,"sourceHtmlUrl":96},"evals\u002Feval_config.yaml",1764,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Feval_config.yaml",{"path":98,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":99,"sourceHtmlUrl":100},"evals\u002Fevals.json",4358,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fevals.json",{"path":102,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":103,"sourceHtmlUrl":104},"evals\u002Fprompts\u002Falready-optimal-key.md",847,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fprompts\u002Falready-optimal-key.md",{"path":106,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":107,"sourceHtmlUrl":108},"evals\u002Fprompts\u002Fmulti-region-replica-deletion.md",1103,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fprompts\u002Fmulti-region-replica-deletion.md",{"path":110,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":111,"sourceHtmlUrl":112},"evals\u002Fprompts\u002Forphaned-key-cleanup.md",874,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fprompts\u002Forphaned-key-cleanup.md",{"path":114,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":115,"sourceHtmlUrl":116},"evals\u002Fprompts\u002Frotation-enablement.md",848,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fprompts\u002Frotation-enablement.md",{"path":118,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":119,"sourceHtmlUrl":120},"evals\u002Fprompts\u002Fstale-grant-retirement.md",923,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fevals\u002Fprompts\u002Fstale-grant-retirement.md",{"path":122,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":123,"sourceHtmlUrl":124},"examples\u002FREADME.md",6213,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fexamples\u002FREADME.md",{"path":126,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":127,"sourceHtmlUrl":128},"references\u002Fadvanced-patterns.md",8446,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Freferences\u002Fadvanced-patterns.md",{"path":130,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":131,"sourceHtmlUrl":132},"references\u002Fdiagnostic-commands.md",4306,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Freferences\u002Fdiagnostic-commands.md",{"path":134,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":135,"sourceHtmlUrl":136},"references\u002Fkms-pricing-and-lifecycle.md",8431,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Freferences\u002Fkms-pricing-and-lifecycle.md",{"path":138,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":139,"sourceHtmlUrl":140},"references\u002Fworked-examples.md",12818,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Freferences\u002Fworked-examples.md",{"path":142,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":143,"sourceHtmlUrl":144},"skill.usf.yaml",4602,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fkms-key-rotation-optimizer\u002Fskill.usf.yaml",[146,153,160,167,174,181],{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":19},"01M7ADVD60X4PCAPKSE58P9NDC","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 \u002F method \u002F 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 \u002F 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 \u002F EKS \u002F 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxray-tracing-deployer\u002FSKILL.md",[],[],{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":19},"01M7ADTVJ7DCBM9CB1FY51GH7J","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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-workload-auditor\u002FSKILL.md",[],[],{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":19},"01M7ADT59G6FTTNZYHT2QRPNNP","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 \u002F 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-review-operator\u002FSKILL.md",[],[],{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":19},"01M7ADSH5JA9QHNPPHQCD7EVA7","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\u002FAPI Gateway\u002FCloudFront, or configuring CAPTCHA\u002FChallenge 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-deployer\u002FSKILL.md",[],[],{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":19},"01M7ADRYFAT8R73FBNCHRC573X","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\u002Fbypass 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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-auditor\u002FSKILL.md",[],[],{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":19},"01M7ADR8W7G72JX4KFGN03QK8Q","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.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaf-rule-deployer\u002FSKILL.md",[],[]]