[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AA6E94MKEYTPKAQ3M20HAA":3,"skill-same:01M7AA6E94MKEYTPKAQ3M20HAA":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},"01M7AA6E94MKEYTPKAQ3M20HAA","msk-cost-optimizer",null,"Optimises Amazon MSK cost across seven dimensions — broker type right-sizing (CloudWatch BytesInPerSec, KafkaDataLogsDiskUsed, consumer lag MaxOffsetLag), broker count optimisation (minimum 3 for HA, reduce excess on low-throughput clusters), EBS storage optimisation (storage-auto-scaling vs fixed gp3, right-size to retention needs), MSK Serverless vs provisioned (break-even ~50 MB\u002Fs ingress), partition count impact (excessive partitions add broker overhead), data retention optimisation (log retention hours, compacted topics for changelog workloads), and Graviton broker migration (Kafka 3.x, kafka.m7g ~20% cheaper). Covers MSK Cluster Tier (Express) and MSK with KRaft. Emits OPTIMIZED, OPPORTUNITY_FOUND, or ALREADY_OPTIMAL per cluster with estimated monthly savings.","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\u002Fmsk-cost-optimizer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: msk-cost-optimizer\ndescription: Optimises Amazon MSK cost across seven dimensions — broker type right-sizing (CloudWatch BytesInPerSec, KafkaDataLogsDiskUsed, consumer lag MaxOffsetLag), broker count optimisation (minimum 3 for HA, reduce excess on low-throughput clusters), EBS storage optimisation (storage-auto-scaling vs fixed gp3, right-size to retention needs), MSK Serverless vs provisioned (break-even ~50 MB\u002Fs ingress), partition count impact (excessive partitions add broker overhead), data retention optimisation (log retention hours, compacted topics for changelog workloads), and Graviton broker migration (Kafka 3.x, kafka.m7g ~20% cheaper). Covers MSK Cluster Tier (Express) and MSK with KRaft. Emits OPTIMIZED, OPPORTUNITY_FOUND, or ALREADY_OPTIMAL per cluster with estimated monthly savings.\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from pasted cluster configuration, CloudWatch summaries, and billing line items. Live-account optimisation uses aws kafka describe-cluster, describe-cluster-v2, list-clusters-v2, aws kafka describe-configuration, aws cloudwatch get-metric-statistics for AWS\u002FKafka BytesInPerSec, BytesOutPerSec, KafkaDataLogsDiskUsed, ConsumerLagMetrics MaxOffsetLag, CpuUser, CpuSystem, aws ce...\nmetadata:\n  domain: aws-cloudops\n  complexity: high\n  requires_llm: 'true'\n  phase: '3'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Analytics\n  task_type: optimize\n  skill_class: capability\n  lifecycle_status: active\n  verdict_shape: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL\n  when_to_use: Reviewing Amazon MSK cluster spend, right-sizing Kafka broker types, evaluating Graviton brokers (kafka.m7g vs kafka.m5), deciding between MSK Serverless and provisioned (break-even ~50 MB\u002Fs), optimising broker count (minimum 3 for HA, reduce excess), auditing EBS storage allocation vs actual disk usage, tuning log retention hours or compacted topics for storage savings, or evaluating MSK Cluster Tier (Express) and MSK with KRaft for cost.\n  when_not_to_use: Self-managed Kafka on EC2 cost optimisation (this skill covers the managed MSK service only), Kafka Connect or MSK Connect cost optimisation (use kafka-connect-troubleshooter or a Connect specialist), Kinesis Data Streams cost optimisation (different service), Kafka performance tuning or partition rebalancing as the primary goal (use a Kafka operations workflow; this skill uses metrics only to identify cost waste), or MSK security or TLS configuration (use a security audit workflow).\n  activation_triggers: optimise MSK cost, right-size MSK broker, MSK Graviton migration, kafka.m7g vs kafka.m5, MSK Serverless vs provisioned, MSK broker count, MSK EBS storage optimisation, MSK log retention, MSK compacted topics, MSK partition count, MSK Cluster Tier Express, MSK KRaft, MSK consumer lag cost, KafkaDataLogsDiskUsed, reduce MSK bill\n  invocation_schema: 'Input: either (a) an MSK cluster ARN or identifier + live-account context, (b) a cluster configuration document (broker type, broker count, EBS volume size, partition count, retention hours, Kafka version, pricing model, CloudWatch metrics), OR (c) a fleet description for batch optimisation. Output: a deterministic TARGET \u002F VERDICT \u002F REASON \u002F RECOMMENDATION \u002F ESTIMATED_SAVINGS \u002F MIGRATION_STEPS block per cluster, where VERDICT ∈ {OPTIMIZED, OPPORTUNITY_FOUND, ALREADY_OPTIMAL}.'\n  invocation_example: \"# Minimal valid input (offline classification):\\nCluster: events-prod-msk\\nKafka Version: 3.5.1\\nRegion: us-east-1\\nBroker Type: kafka.m5.large (2 vCPU, 8 GB)\\nBroker Count: 6\\nEBS Volume: 1 TB gp3 per broker\\nPartitions: 120 across 15 topics\\nLog Retention: 168 hours (7 days)\\nCompacted Topics: none\\nPricing: On-Demand (no commit)\\nCloudWatch metrics (last 30 days):\\n  - BytesInPerSec per broker: avg=5, max=12\\n  - KafkaDataLogsDiskUsed: avg=25%, max=35%\\n  - MaxOffsetLag: avg=1,000 (low consumer lag)\\nEmit the standard optimisation block (TARGET, VERDICT, REASON,\\nRECOMMENDATION, ESTIMATED_SAVINGS, MIGRATION_STEPS).\"\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: Amazon MSK, Amazon Managed Streaming for Apache Kafka, MSK Serverless, MSK Express, MSK Cluster Tier, MSK KRaft, Graviton brokers, kafka.m7g, broker right-sizing, EBS storage optimisation, log retention, compacted topics, partition count, consumer lag, KafkaDataLogsDiskUsed, data retention, FinOps, streaming cost\n  tags: msk, kafka, analytics, cost-optimization, finops, right-sizing, serverless\n---\n\n# MSK Cost Optimizer\n\n## What this skill does\n\nOptimises Amazon MSK cost across seven dimensions: broker type right-\nsizing, Graviton broker migration, broker count optimisation, EBS storage\noptimisation, MSK Serverless vs provisioned fit, partition count impact,\nand data retention optimisation. Emits a deterministic verdict per cluster\nwith estimated monthly savings and a one-dimension-per-window migration\nplan.\n\n## STRICT output contract\n\nEvery invocation MUST emit exactly one optimisation block per cluster\nin this shape — no prose before, no commentary after:\n\n```text\nTARGET: \u003Ccluster-name or cluster-arn>\nVERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL\nREASON: \u003C1-2 sentences naming the recommendation and supporting data>\nRECOMMENDATION:\n  Current: \u003Cbroker-type, broker-count, EBS-volume, partitions,\n            retention, pricing model, Kafka version, tier>\n  Proposed: \u003Cper-dimension list of changes>\n  Confidence: \u003CHIGH\u002FMEDIUM\u002FLOW> — \u003Cone-line rationale>\nESTIMATED_SAVINGS:\n  Monthly (broker right-sizing): $\u003Camount>\n  Monthly (Graviton migration): $\u003Camount>\n  Monthly (broker count reduction): $\u003Camount>\n  Monthly (EBS storage): $\u003Camount>\n  Monthly (serverless fit): $\u003Camount>\n  Monthly (retention \u002F compaction): $\u003Camount>\n  Monthly (partition right-sizing): $0  (operational, no direct cost)\n  Annual total: $\u003Camount>\n  Assumptions: \u003Cpricing region, 730h\u002Fmonth, etc.>\nMIGRATION_STEPS:\n  1. \u003Cspecific action with CLI command>\n  2. \u003Cverification step>\nCONFIRM: Before executing any state-changing CLI, emit and await operator\n  approval: \"CONFIRM: About to \u003Caction> on \u003Ccluster>. Proceed? (yes\u002Fno)\"\n```\n\nA block missing VERDICT, RECOMMENDATION, ESTIMATED_SAVINGS, or\nMIGRATION_STEPS is a contract violation — re-emit the full block.\n\n### FORBIDDEN output patterns\n\n1. **NEVER emit `VERDICT: OPPORTUNITY_FOUND` with `Annual total: $0`.**\n   If all seven dimensions net zero savings, the verdict MUST be\n   `ALREADY_OPTIMAL`. A cost-neutral operational improvement (e.g.,\n   partition right-sizing) is surfaced in REASON, not as a dollar\n   saving.\n\n2. **NEVER show savings math that does not balance.** The sum of all\n   `Monthly (...)` lines MUST equal the Monthly total, and\n   `Monthly total × 12` MUST equal `Annual total`, rounded to 2 decimal\n   places. Re-verify before emitting.\n\n3. **NEVER recommend Graviton brokers (`kafka.m7g`) without confirming\n   Kafka version 3.x or later.** Kafka 2.x does NOT support Graviton\n   broker types. Recommending Graviton on a Kafka 2.x cluster without\n   first planning the version upgrade will fail at cluster creation.\n\n4. **NEVER recommend reducing MSK broker count below 3.** Kafka requires\n   a minimum of 3 brokers for replication factor=3 and quorum-based\n   fault tolerance. A 2-broker cluster cannot survive a single broker\n   failure without data loss.\n\n5. **NEVER recommend decreasing EBS volume size in-place.** MSK supports\n   online EBS volume increases via `update-broker-storage`, but NOT\n   decreases. EBS reduction requires blue\u002Fgreen cluster migration. Flag\n   it for the next migration window, never as an immediate action.\n\n6. **NEVER recommend MSK Serverless for a workload exceeding 50 MB\u002Fs\n   sustained ingress without computing the full 30-day break-even\n   cost.** Serverless per-partition-hour + per-GB data pricing exceeds\n   provisioned broker cost at high sustained throughput.\n\n7. **NEVER omit the `CONFIRM:` gate before any state-changing CLI\n   command.** Every `create-cluster-v2`, `update-cluster-configuration`,\n   `update-broker-storage`, `delete-cluster`, and `kafka-configs --alter`\n   MUST be preceded by a CONFIRM line and operator approval.\n\n8. **NEVER emit scratch or recompute text** (\"WAIT\", \"let me redo\",\n   \"corrected:\") in the output block. Finalize all math before emitting\n   the block.\n\n## Quick start\n\nCore quick-start heuristics (Graviton ~20% cheaper on Kafka 3.x, Serverless break-even ~50 MB\u002Fs, minimum 3 brokers, EBS and retention cost drivers): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nThe decision tables in Steps 4-10 below encode the same thresholds.\n\n## Mindset\n\nCost-structure fundamentals (how MSK cost differs from databases): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nThe verdict thresholds below assume them.\n\n## Quick reference — verdict thresholds\n\n| Observation | Verdict | Dimension |\n|---|---|---|\n| Cluster on kafka.m5 (pre-Graviton), Kafka 3.x+ | **OPPORTUNITY_FOUND** | Graviton migration |\n| BytesInPerSec per broker avg \u003C 10 MB\u002Fs on kafka.m5.2xlarge+ | **OPPORTUNITY_FOUND** | Broker right-sizing |\n| Broker count > 3, total ingress \u003C 50 MB\u002Fs, partitions \u003C 400\u002Fbroker | **OPPORTUNITY_FOUND** | Broker count reduction |\n| KafkaDataLogsDiskUsed avg \u003C 30% on 1 TB+ EBS volumes | **OPPORTUNITY_FOUND** | EBS storage |\n| Total ingress \u003C 50 MB\u002Fs with idle periods, provisioned | **OPPORTUNITY_FOUND** | Serverless fit |\n| Log retention > 168h on high-throughput, non-compacted topic | **OPPORTUNITY_FOUND** | Retention |\n| Partition count > 1000 total with low throughput per partition | **OPPORTUNITY_FOUND** | Partition right-sizing |\n| All seven dimensions at cost-optimal config | **ALREADY_OPTIMAL** | (continue monitoring) |\n\n## Pre-flight: data gate (run before any optimisation decision)\n\nMSK optimisation requires four data sources: Cost Explorer for billing\nline items, cluster configuration (broker type, count, EBS, partitions,\nretention), CloudWatch metrics for utilisation, and topic-level\nconfiguration.\n\n### Required data sources\n\nThe four data-gathering command blocks (Cost Explorer breakdown, cluster configuration, CloudWatch metrics, topic configuration): moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nRun them before any optimisation decision, then apply the data-quality short-circuits below.\n\n### Data-quality short-circuits\n\n| Condition | Effect on optimisation |\n|---|---|\n| Cost Explorer access denied | NEED_MORE_INFO for cost quantification; topology still analysable. |\n| Observation window \u003C 14 days | NEED_MORE_INFO: workload may reflect atypical load. Min 14 days; 30 preferred. |\n| Cluster in `CREATING` \u002F `UPDATING` \u002F `MAINTENANCE` | Wait for `ACTIVE` before emitting a change recommendation. |\n| MSK Serverless cluster (no broker type) | Skip broker right-size + count dimensions; analyse per-partition pricing. |\n| Kafka version \u003C 3.0 | Graviton brokers not available; note version upgrade prerequisite. |\n| Multi-VPC or cross-region replication active | Each region's cluster bills independently; analyse separately. |\n\n## Process — Optimisation logic (apply in order)\n\n### Step 0: Non-obvious behaviours that change the recommendation\n\nNon-obvious behaviours that change the recommendation (Graviton\u002FKafka-version coupling, broker-count immutability, EBS one-way scaling, Serverless billing model, partition overhead, compaction, Express tier, KRaft, retention): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad before emitting any recommendation; Steps 1-11 assume these constraints.\n\n### Step 1: Validate input and data sufficiency\n\nIf Cost Explorer access is unavailable AND the caller has not pasted\nbilling line items, emit NEED_MORE_INFO:\n\nFallback data-gathering commands when Cost Explorer is unavailable: moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nIf neither CE access nor pasted data exists, emit NEED_MORE_INFO.\n\n### Step 2: Cost Explorer reconciliation\n\nCost Explorer reconciliation command block: moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nThe USAGE_TYPE classification table stays below.\n\n| USAGE_TYPE | Dimension | What it represents |\n|---|---|---|\n| `MSK:BrokerUsage` | Compute (provisioned) | Per-broker-hour by type |\n| `MSK:ServerlessUsage` | Compute (Serverless) | Per-partition-hour + per-GB data |\n| `MSK:EBSUsage` | EBS storage | Per-GB-month of broker-attached volume |\n\nIf `MSK:BrokerUsage` dominates with kafka.m5 brokers, the Graviton\nmigration is the first lever. If `MSK:EBSUsage` is > 30% of total, the\nretention\u002Fstorage dimension has high leverage.\n\n### Step 3: Cost classification\n\n| Cost profile | Indicators | Emphasis |\n|---|---|---|\n| Pre-Graviton | kafka.m5 brokers, Kafka 3.x+ | Graviton migration (Step 5) |\n| Over-provisioned brokers | BytesInPerSec\u002Fbroker \u003C 10 MB\u002Fs on large type | Broker right-sizing (Step 4) |\n| Excess broker count | > 3 brokers, total ingress \u003C 50 MB\u002Fs | Broker count (Step 7) |\n| EBS over-allocated | KafkaDataLogsDiskUsed avg \u003C 30% | EBS storage (Step 8) |\n| Serverless candidate | Ingress \u003C 50 MB\u002Fs, idle periods | Serverless fit (Step 6) |\n| Retention-driven storage | EBSUsage high, retention > 168h | Retention (Step 9) |\n| Partition-heavy | > 400 partitions\u002Fbroker, low throughput | Partition right-sizing (Step 10) |\n| Mixed (no single dimension dominant) | Even distribution | Apply all in parallel |\n\n### Step 4: Broker type right-sizing\n\n**Decision matrix:**\n\n| Throughput profile (30-day) | Recommendation | Savings estimate |\n|---|---|---|\n| BytesInPerSec\u002Fbroker avg \u003C 5 MB\u002Fs on kafka.m5.2xlarge | Downsize to kafka.m5.large or kafka.m7g.large | ~50% of compute |\n| BytesInPerSec\u002Fbroker avg 5-20 MB\u002Fs | Keep current broker type | None |\n| BytesInPerSec\u002Fbroker avg > 30 MB\u002Fs frequently | Upsize or add brokers | None — already constrained |\n| CpuUser + CpuSystem avg > 60% | CPU-bound; don't downsize | None |\n| Consumer lag (MaxOffsetLag) growing | Throughput-bound; don't downsize | None |\n\nWorked example (m5.2xlarge right-sizing math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the decision matrix above to reproduce it.\n\n### Step 5: Graviton broker migration\n\nThis is the highest-leverage dimension when the cluster is on kafka.m5\nand Kafka version is 3.x+.\n\n| Current | Target | Savings | Notes |\n|---|---|---|---|\n| kafka.m5.large ($0.276\u002Fh) | kafka.m7g.large ($0.22\u002Fh) | ~20% | Same 2 vCPU \u002F 8 GB |\n| kafka.m5.2xlarge ($0.552\u002Fh) | kafka.m7g.2xlarge ($0.44\u002Fh) | ~20% | Same 8 vCPU \u002F 32 GB |\n| kafka.m5.4xlarge ($1.104\u002Fh) | kafka.m7g.4xlarge ($0.88\u002Fh) | ~20% | Same 16 vCPU \u002F 64 GB |\n| kafka.c5.large (legacy) | kafka.m7g.large | ~15% | c5 → m7g class change |\n\nWorked example (Graviton migration savings math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the migration matrix above to reproduce it.\n\n### Step 6: MSK Serverless vs provisioned fit evaluation\n\nServerless eliminates broker management and bills per partition-hour +\nper-GB data + per-PUT-hour. The break-even calculation compares total\nprovisioned cost against projected Serverless pricing.\n\n**Break-even logic:**\n\nServerless break-even calculation block: moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nBreak-even heuristic: below ~50 MB\u002Fs sustained ingress Serverless is usually cheaper.\n\nA rough heuristic: if the provisioned cluster's total sustained ingress\nis below ~50 MB\u002Fs, or if the cluster idles for extended periods,\nServerless is likely cheaper. Above 50 MB\u002Fs steady, provisioned with\nGraviton brokers is cheaper.\n\n| Provisioned profile | Recommendation | Rationale |\n|---|---|---|\n| Ingress \u003C 50 MB\u002Fs, variable load | Migrate to Serverless | Pay only for partitions + data |\n| Ingress \u003C 50 MB\u002Fs, steady, few partitions | Evaluate Serverless | Break-even zone; compute 30-day cost |\n| Ingress > 50 MB\u002Fs steady | Keep provisioned + Graviton | Provisioned cheaper at scale |\n| > 1000 partitions | Keep provisioned | Serverless per-partition-hour adds up |\n| Dev\u002Ftest, idle nights\u002Fweekends | Migrate to Serverless | Near-zero cost when idle |\n\nWorked example (Serverless vs provisioned math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the fit table above to reproduce it.\n\n### Step 7: Broker count optimisation\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| Broker count=6, total ingress \u003C 50 MB\u002Fs, partitions \u003C 120 | Reduce to 3 brokers (blue\u002Fgreen migration) | ~50% of compute |\n| Broker count=3, ingress > 50 MB\u002Fs, consumer lag growing | Add brokers (scale out) | None — capacity-bound |\n| Broker count=3 (minimum for HA) | Keep; cannot reduce below 3 | None |\n| Broker count > 3 with replication factor=3 | Evaluate reducing to 3 if throughput allows | Per excess broker |\n\nWorked example (6-to-3 broker reduction math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the observation table above to reproduce it.\n\n### Step 8: EBS storage optimisation\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| KafkaDataLogsDiskUsed avg \u003C 30% on 1 TB+ volumes | Reduce volume on next blue\u002Fgreen | Per-GB-month saved |\n| KafkaDataLogsDiskUsed growing > 10%\u002Fmonth | Enable MSK storage auto-expand | Prevents volume exhaustion |\n| Fixed volume with predictable growth | Evaluate auto-expand vs manual right-size | Operational savings |\n| Volume per broker > 2x the data need | Right-size to 1.3x actual usage | ~35% of EBS cost |\n\nWorked example (EBS volume right-sizing math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the observation table above to reproduce it.\n\n### Step 9: Data retention and compaction optimisation\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| Retention > 168h on high-throughput non-compacted topic | Reduce to 24-72h if replay not needed | Up to 7x storage |\n| Compaction candidate (changelog, event-sourcing) with time retention | Switch to cleanup.policy=compact | 10x storage reduction |\n| Mixed retention policy, some topics overly long | Audit topic-level configs; standardise | Variable |\n| Retention = -1 (infinite) on any topic | Set finite retention immediately | Prevents unbounded growth |\n\nWorked example (retention and compaction math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the observation table above to reproduce it.\n\n### Step 10: Partition count right-sizing\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| > 400 partitions\u002Fbroker with low throughput\u002Fpartition | Consolidate partitions (operational) | Enables broker downsize |\n| 1000 partitions for a 1 MB\u002Fs workload | Reduce to 12-24 partitions | Frees broker CPU |\n| Uneven partition distribution | Reassign partitions (kafka-reassign-partitions) | Performance, not cost |\n| Consumer group reading from few partitions | Reduce partition count to match consumer parallelism | Enables downsize |\n\nPartition right-sizing has no direct cost savings, but reducing\nexcessive partitions frees broker CPU and memory, which can then enable\na broker type downsize. This is a force-multiplier for Step 4.\n\n### Step 11: Final verdict\n\nThe verdict is the worst-case (most-actionable) finding across all\nseven dimensions:\n\n- If ANY dimension has a concrete recommendation with quantified\n  savings, verdict is **OPPORTUNITY_FOUND**.\n- If a change was applied and verified this session, verdict is\n  **OPTIMIZED**.\n- If all dimensions are at cost-optimal config AND broker count,\n  retention, and Serverless fit have been evaluated, verdict is\n  **ALREADY_OPTIMAL**.\n\n## Output format\n\n### Worked example — multi-dimension opportunity\n\n```text\nTARGET: events-prod-msk\nVERDICT: OPPORTUNITY_FOUND\nREASON: Cluster runs kafka.m5.large (pre-Graviton) with 6 brokers,\n  1 TB EBS per broker at 25% disk used, 168h retention on a\n  high-throughput topic that only needs 24h, total ingress 15 MB\u002Fs\n  (well under the 50 MB\u002Fs Serverless break-even candidate range),\n  and Kafka 3.5.1 (Graviton-ready). Five dimensions have actionable\n  opportunities.\nRECOMMENDATION:\n  Current:\n    Brokers: 6 x kafka.m5.large ($0.276\u002Fh) = $1,209\u002Fmonth\n    EBS: 6 x 1 TB gp3 = $480\u002Fmonth\n    Retention: 168h (7 days) on events topic\n    Partitions: 120 across 15 topics\n    Pricing: On-Demand (no commit)\n  Proposed:\n    - Graviton migration: kafka.m5.large -> kafka.m7g.large ($0.22\u002Fh,\n      20% cheaper). Kafka 3.5.1 supports Graviton.\n    - Broker count: reduce 6 -> 3 brokers (blue\u002Fgreen migration).\n      Total ingress 15 MB\u002Fs is 5 MB\u002Fs\u002Fbroker on 3 brokers — well within\n      capacity. Partition ratio 40\u002Fbroker (under 400 ceiling).\n    - EBS: reduce 1 TB -> 500 GB per broker on new cluster (disk used\n      is 25% = 250 GB; 500 GB gives 2x headroom). Enable auto-expand.\n    - Retention: reduce events topic from 168h -> 24h (data-replay\n      requirement is 24h).\n    - Combined: migrate to kafka.m7g.large x 3 brokers with 500 GB EBS\n      and 24h retention in a single blue\u002Fgreen migration.\n  Confidence: HIGH — CloudWatch confirms low disk utilisation; CE\n    confirms On-Demand spend with no discount; Kafka version supports\n    Graviton.\nESTIMATED_SAVINGS:\n  Monthly (Graviton migration): $122  (3 x ($0.276-$0.22) x 730)\n  Monthly (broker count 6->3): $604   (3 x $0.276 x 730)\n  Monthly (EBS 1TB->500GB): $120      (3 x 500GB x $0.08)\n  Monthly (retention 168h->24h): $411 (storage delta on events topic)\n  Annual total: $15,084\n  Assumptions: us-east-1 pricing, 730h\u002Fmonth, all changes applied via\n    blue\u002Fgreen migration to a new cluster.\nMIGRATION_STEPS:\n  1. Snapshot current topic configurations and consumer group offsets:\n     aws kafka describe-cluster-v2 --cluster-arn $CLUSTER_ARN\n     # Record partition count, replication factor, retention per topic\n  2. Create the new MSK cluster with optimised config:\n     aws kafka create-cluster-v2 \\\n       --cluster-name events-prod-msk-v2 \\\n       --provisioned '{\"BrokerNodeGroupInfo\":{\\\n         \"InstanceType\":\"kafka.m7g.large\",\\\n         \"BrokerCount\":3,\\\n         \"StorageInfo\":{\"VolumeSize\":500}},\\\n         \"KafkaVersion\":\"3.5.1\"}'\n  3. Set retention to 24h on the events topic in the new cluster:\n     kafka-configs --bootstrap-server $NEW_BROKERS \\\n       --alter --topic events \\\n       --add-config retention.ms=86400000\n  4. Sync data via MirrorMaker2 or MSK Cluster Linking:\n     # Start MirrorMaker2 to replicate topics from old -> new cluster\n  5. Cut over producers and consumers to the new cluster.\n  6. Verify BytesInPerSec, KafkaDataLogsDiskUsed, and MaxOffsetLag\n     are stable for 7 days on the new cluster.\n  7. Decommission the old cluster:\n     aws kafka delete-cluster --cluster-arn $OLD_CLUSTER_ARN\nCONFIRM: Before each state-changing CLI, emit and await operator\n  approval. Stage the blue\u002Fgreen migration with monitoring between\n  each step; never batch the cut-over + decommission.\n```\n\n### Worked example — already optimal\n\nFull worked example for an ALREADY_OPTIMAL verdict: moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nThe multi-dimension example above is the primary contract demonstration.\n\n## Anti-Patterns — NEVER do these things\n\n- **NEVER recommend reducing MSK broker count below 3.** Kafka requires\n  a minimum of 3 brokers for replication factor=3 and quorum-based\n  fault tolerance. A 2-broker cluster cannot survive a single broker\n  failure without data loss. Always retain at least 3 brokers for HA.\n\n- **NEVER recommend Graviton brokers without confirming Kafka version\n  3.x+.** Kafka 2.x does not support Graviton (m7g\u002Fm6g) broker types.\n  Recommending Graviton on a Kafka 2.x cluster without first planning\n  the version upgrade will fail at cluster creation.\n\n- **NEVER recommend decreasing EBS volume size in-place.** MSK supports\n  online EBS volume increases via update-broker-storage, but NOT\n  decreases. Decreasing EBS requires cluster recreation via blue\u002Fgreen\n  migration. Always flag EBS reduction for the next migration, not as\n  an immediate action.\n\n- **NEVER recommend MSK Serverless for a workload exceeding 50 MB\u002Fs\n  sustained ingress without computing the full break-even.** Serverless\n  per-partition-hour + per-GB data pricing exceeds provisioned broker\n  cost at high sustained throughput. Always compute the 30-day projected\n  Serverless cost and compare against provisioned + Graviton cost.\n\n- **NEVER recommend reducing log retention without confirming the\n  data-replay requirement.** Consumers may depend on historical data\n  for batch processing, backfill, or audit. Always confirm the required\n  replay window before shortening retention. For audit requirements,\n  consider exporting to S3 before reducing Kafka-side retention.\n\n- NEVER recommend switching a topic to cleanup.policy=compact without\n  confirming the topic is key-based. Compaction on a topic with null\n  keys or append-only events will delete data unpredictably.\n- NEVER recommend adding partitions to solve a throughput problem\n  without checking the consumer parallelism first. More partitions add\n  broker overhead; if consumers can't parallelise, the partitions are\n  wasted cost.\n- NEVER batch a blue\u002Fgreen migration's cut-over and decommission in\n  one step. Always cut over, verify for 7 days, then decommission the\n  old cluster.\n- NEVER purchase a 3-year commitment on a cluster with active migration\n  plans. The commitment outlasts the cluster. Match commit term to\n  expected cluster lifetime.\n- NEVER recommend MSK Express tier for a steady-state workload. Express\n  burst credits deplete under sustained load; Express is for variable-\n  throughput workloads that burst occasionally.\n\n## Quick navigation\n\n| You want to... | Jump to |\n|---|---|\n| Evaluate Graviton migration (m5 -> m7g) | Step 5 — Graviton migration |\n| Right-size broker type | Step 4 — Broker right-sizing |\n| Reduce broker count (6 -> 3) | Step 7 — Broker count optimisation |\n| Evaluate MSK Serverless vs provisioned | Step 6 — Serverless fit |\n| Optimise EBS storage | Step 8 — EBS storage optimisation |\n| Reduce log retention \u002F enable compaction | Step 9 — Retention and compaction |\n| Reduce excessive partitions | Step 10 — Partition right-sizing |\n| Handle missing data | Step 1 — Validate input |\n| Look up pricing \u002F broker types | references\u002Fmsk-pricing-reference.md |\n\n## Expert heuristic — the 60-second triage\n\nThe 60-second triage (six checks to run when handed an MSK bill): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nIf any check hits, deep-dive the corresponding Process step.\n\n## Pre-flight safety checks (run before any remediation CLI)\n\nPre-flight safety checks (confirmation gate, state recording, one-dimension-per-window, post-change verification, blue\u002Fgreen migration, 3-cluster batch limit): moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nNEVER omit the CONFIRM gate — see FORBIDDEN output patterns above.\n\n## Verdict semantics\n\n| Verdict | When to emit | Position in workflow |\n|---|---|---|\n| `OPPORTUNITY_FOUND` | At least one dimension has a savings-bearing recommendation. | Primary — terminal for actionable findings. |\n| `OPTIMIZED` | A change was applied and verified this session; CE line items confirm the new pattern. | Primary — only emitted post-remediation. |\n| `ALREADY_OPTIMAL` | All seven dimensions at cost-optimal config AND broker count, retention, and Serverless fit evaluated. | Primary — terminal for healthy findings. |\n| `NEED_MORE_INFO` | Data gate failed: CE access denied, CloudWatch window \u003C 14 days, Kafka version unknown. | Pre-decision — emit per-dimension; other dimensions can still emit OPPORTUNITY_FOUND. |\n\n## Recent AWS features (2024-2026)\n\nRecent AWS features (2024-2026): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nCheck before recommending Express tier, KRaft, or the newest broker types.\n\n## AWS documentation\n\nDomain: AWS CloudOps \u002F Analytics — Amazon MSK cost optimisation.\n\n- **Amazon MSK pricing** — https:\u002F\u002Faws.amazon.com\u002Fmsk\u002Fpricing\u002F\n- **MSK Serverless** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fserverless.html\n- **MSK broker types** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fmsk-create-cluster.html\n- **MSK Cluster Tier (Express)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fsupported-broker-types.html\n- **MSK with KRaft** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fkraft.html\n- **MSK storage** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fmsk-storage.html\n- **MSK Cluster Linking** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fmsk-cluster-linking.html\n- **AWS Cost Explorer** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcost-management\u002Flatest\u002Fuserguide\u002Fce-what-is.html\n- **Well-Architected — Cost Optimization** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fwellarchitected\u002Flatest\u002Fcost-optimization-pillar\u002Fwelcome.html\n\n## References (load on demand)\n\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Step 0 non-obvious behaviours, quick-start heuristics, cost-structure fundamentals, 60-second triage, recent AWS features (2024-2026).\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — Required data-source commands, Step 1\u002FStep 2 command blocks, pre-flight safety checks.\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — Secondary worked examples (right-sizing, Graviton, Serverless break-even, broker count, EBS, retention, already-optimal).\n- [references\u002Fmsk-pricing-reference.md](references\u002Fmsk-pricing-reference.md) — Broker-type pricing, Graviton savings matrix, Serverless pricing, EBS and retention cost projections.\n\n\n","# MSK Cost Optimizer\n\n## What this skill does\n\nOptimises Amazon MSK cost across seven dimensions: broker type right-\nsizing, Graviton broker migration, broker count optimisation, EBS storage\noptimisation, MSK Serverless vs provisioned fit, partition count impact,\nand data retention optimisation. Emits a deterministic verdict per cluster\nwith estimated monthly savings and a one-dimension-per-window migration\nplan.\n\n## STRICT output contract\n\nEvery invocation MUST emit exactly one optimisation block per cluster\nin this shape — no prose before, no commentary after:\n\n```text\nTARGET: \u003Ccluster-name or cluster-arn>\nVERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL\nREASON: \u003C1-2 sentences naming the recommendation and supporting data>\nRECOMMENDATION:\n  Current: \u003Cbroker-type, broker-count, EBS-volume, partitions,\n            retention, pricing model, Kafka version, tier>\n  Proposed: \u003Cper-dimension list of changes>\n  Confidence: \u003CHIGH\u002FMEDIUM\u002FLOW> — \u003Cone-line rationale>\nESTIMATED_SAVINGS:\n  Monthly (broker right-sizing): $\u003Camount>\n  Monthly (Graviton migration): $\u003Camount>\n  Monthly (broker count reduction): $\u003Camount>\n  Monthly (EBS storage): $\u003Camount>\n  Monthly (serverless fit): $\u003Camount>\n  Monthly (retention \u002F compaction): $\u003Camount>\n  Monthly (partition right-sizing): $0  (operational, no direct cost)\n  Annual total: $\u003Camount>\n  Assumptions: \u003Cpricing region, 730h\u002Fmonth, etc.>\nMIGRATION_STEPS:\n  1. \u003Cspecific action with CLI command>\n  2. \u003Cverification step>\nCONFIRM: Before executing any state-changing CLI, emit and await operator\n  approval: \"CONFIRM: About to \u003Caction> on \u003Ccluster>. Proceed? (yes\u002Fno)\"\n```\n\nA block missing VERDICT, RECOMMENDATION, ESTIMATED_SAVINGS, or\nMIGRATION_STEPS is a contract violation — re-emit the full block.\n\n### FORBIDDEN output patterns\n\n1. **NEVER emit `VERDICT: OPPORTUNITY_FOUND` with `Annual total: $0`.**\n   If all seven dimensions net zero savings, the verdict MUST be\n   `ALREADY_OPTIMAL`. A cost-neutral operational improvement (e.g.,\n   partition right-sizing) is surfaced in REASON, not as a dollar\n   saving.\n\n2. **NEVER show savings math that does not balance.** The sum of all\n   `Monthly (...)` lines MUST equal the Monthly total, and\n   `Monthly total × 12` MUST equal `Annual total`, rounded to 2 decimal\n   places. Re-verify before emitting.\n\n3. **NEVER recommend Graviton brokers (`kafka.m7g`) without confirming\n   Kafka version 3.x or later.** Kafka 2.x does NOT support Graviton\n   broker types. Recommending Graviton on a Kafka 2.x cluster without\n   first planning the version upgrade will fail at cluster creation.\n\n4. **NEVER recommend reducing MSK broker count below 3.** Kafka requires\n   a minimum of 3 brokers for replication factor=3 and quorum-based\n   fault tolerance. A 2-broker cluster cannot survive a single broker\n   failure without data loss.\n\n5. **NEVER recommend decreasing EBS volume size in-place.** MSK supports\n   online EBS volume increases via `update-broker-storage`, but NOT\n   decreases. EBS reduction requires blue\u002Fgreen cluster migration. Flag\n   it for the next migration window, never as an immediate action.\n\n6. **NEVER recommend MSK Serverless for a workload exceeding 50 MB\u002Fs\n   sustained ingress without computing the full 30-day break-even\n   cost.** Serverless per-partition-hour + per-GB data pricing exceeds\n   provisioned broker cost at high sustained throughput.\n\n7. **NEVER omit the `CONFIRM:` gate before any state-changing CLI\n   command.** Every `create-cluster-v2`, `update-cluster-configuration`,\n   `update-broker-storage`, `delete-cluster`, and `kafka-configs --alter`\n   MUST be preceded by a CONFIRM line and operator approval.\n\n8. **NEVER emit scratch or recompute text** (\"WAIT\", \"let me redo\",\n   \"corrected:\") in the output block. Finalize all math before emitting\n   the block.\n\n## Quick start\n\nCore quick-start heuristics (Graviton ~20% cheaper on Kafka 3.x, Serverless break-even ~50 MB\u002Fs, minimum 3 brokers, EBS and retention cost drivers): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nThe decision tables in Steps 4-10 below encode the same thresholds.\n\n## Mindset\n\nCost-structure fundamentals (how MSK cost differs from databases): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nThe verdict thresholds below assume them.\n\n## Quick reference — verdict thresholds\n\n| Observation | Verdict | Dimension |\n|---|---|---|\n| Cluster on kafka.m5 (pre-Graviton), Kafka 3.x+ | **OPPORTUNITY_FOUND** | Graviton migration |\n| BytesInPerSec per broker avg \u003C 10 MB\u002Fs on kafka.m5.2xlarge+ | **OPPORTUNITY_FOUND** | Broker right-sizing |\n| Broker count > 3, total ingress \u003C 50 MB\u002Fs, partitions \u003C 400\u002Fbroker | **OPPORTUNITY_FOUND** | Broker count reduction |\n| KafkaDataLogsDiskUsed avg \u003C 30% on 1 TB+ EBS volumes | **OPPORTUNITY_FOUND** | EBS storage |\n| Total ingress \u003C 50 MB\u002Fs with idle periods, provisioned | **OPPORTUNITY_FOUND** | Serverless fit |\n| Log retention > 168h on high-throughput, non-compacted topic | **OPPORTUNITY_FOUND** | Retention |\n| Partition count > 1000 total with low throughput per partition | **OPPORTUNITY_FOUND** | Partition right-sizing |\n| All seven dimensions at cost-optimal config | **ALREADY_OPTIMAL** | (continue monitoring) |\n\n## Pre-flight: data gate (run before any optimisation decision)\n\nMSK optimisation requires four data sources: Cost Explorer for billing\nline items, cluster configuration (broker type, count, EBS, partitions,\nretention), CloudWatch metrics for utilisation, and topic-level\nconfiguration.\n\n### Required data sources\n\nThe four data-gathering command blocks (Cost Explorer breakdown, cluster configuration, CloudWatch metrics, topic configuration): moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nRun them before any optimisation decision, then apply the data-quality short-circuits below.\n\n### Data-quality short-circuits\n\n| Condition | Effect on optimisation |\n|---|---|\n| Cost Explorer access denied | NEED_MORE_INFO for cost quantification; topology still analysable. |\n| Observation window \u003C 14 days | NEED_MORE_INFO: workload may reflect atypical load. Min 14 days; 30 preferred. |\n| Cluster in `CREATING` \u002F `UPDATING` \u002F `MAINTENANCE` | Wait for `ACTIVE` before emitting a change recommendation. |\n| MSK Serverless cluster (no broker type) | Skip broker right-size + count dimensions; analyse per-partition pricing. |\n| Kafka version \u003C 3.0 | Graviton brokers not available; note version upgrade prerequisite. |\n| Multi-VPC or cross-region replication active | Each region's cluster bills independently; analyse separately. |\n\n## Process — Optimisation logic (apply in order)\n\n### Step 0: Non-obvious behaviours that change the recommendation\n\nNon-obvious behaviours that change the recommendation (Graviton\u002FKafka-version coupling, broker-count immutability, EBS one-way scaling, Serverless billing model, partition overhead, compaction, Express tier, KRaft, retention): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad before emitting any recommendation; Steps 1-11 assume these constraints.\n\n### Step 1: Validate input and data sufficiency\n\nIf Cost Explorer access is unavailable AND the caller has not pasted\nbilling line items, emit NEED_MORE_INFO:\n\nFallback data-gathering commands when Cost Explorer is unavailable: moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nIf neither CE access nor pasted data exists, emit NEED_MORE_INFO.\n\n### Step 2: Cost Explorer reconciliation\n\nCost Explorer reconciliation command block: moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nThe USAGE_TYPE classification table stays below.\n\n| USAGE_TYPE | Dimension | What it represents |\n|---|---|---|\n| `MSK:BrokerUsage` | Compute (provisioned) | Per-broker-hour by type |\n| `MSK:ServerlessUsage` | Compute (Serverless) | Per-partition-hour + per-GB data |\n| `MSK:EBSUsage` | EBS storage | Per-GB-month of broker-attached volume |\n\nIf `MSK:BrokerUsage` dominates with kafka.m5 brokers, the Graviton\nmigration is the first lever. If `MSK:EBSUsage` is > 30% of total, the\nretention\u002Fstorage dimension has high leverage.\n\n### Step 3: Cost classification\n\n| Cost profile | Indicators | Emphasis |\n|---|---|---|\n| Pre-Graviton | kafka.m5 brokers, Kafka 3.x+ | Graviton migration (Step 5) |\n| Over-provisioned brokers | BytesInPerSec\u002Fbroker \u003C 10 MB\u002Fs on large type | Broker right-sizing (Step 4) |\n| Excess broker count | > 3 brokers, total ingress \u003C 50 MB\u002Fs | Broker count (Step 7) |\n| EBS over-allocated | KafkaDataLogsDiskUsed avg \u003C 30% | EBS storage (Step 8) |\n| Serverless candidate | Ingress \u003C 50 MB\u002Fs, idle periods | Serverless fit (Step 6) |\n| Retention-driven storage | EBSUsage high, retention > 168h | Retention (Step 9) |\n| Partition-heavy | > 400 partitions\u002Fbroker, low throughput | Partition right-sizing (Step 10) |\n| Mixed (no single dimension dominant) | Even distribution | Apply all in parallel |\n\n### Step 4: Broker type right-sizing\n\n**Decision matrix:**\n\n| Throughput profile (30-day) | Recommendation | Savings estimate |\n|---|---|---|\n| BytesInPerSec\u002Fbroker avg \u003C 5 MB\u002Fs on kafka.m5.2xlarge | Downsize to kafka.m5.large or kafka.m7g.large | ~50% of compute |\n| BytesInPerSec\u002Fbroker avg 5-20 MB\u002Fs | Keep current broker type | None |\n| BytesInPerSec\u002Fbroker avg > 30 MB\u002Fs frequently | Upsize or add brokers | None — already constrained |\n| CpuUser + CpuSystem avg > 60% | CPU-bound; don't downsize | None |\n| Consumer lag (MaxOffsetLag) growing | Throughput-bound; don't downsize | None |\n\nWorked example (m5.2xlarge right-sizing math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the decision matrix above to reproduce it.\n\n### Step 5: Graviton broker migration\n\nThis is the highest-leverage dimension when the cluster is on kafka.m5\nand Kafka version is 3.x+.\n\n| Current | Target | Savings | Notes |\n|---|---|---|---|\n| kafka.m5.large ($0.276\u002Fh) | kafka.m7g.large ($0.22\u002Fh) | ~20% | Same 2 vCPU \u002F 8 GB |\n| kafka.m5.2xlarge ($0.552\u002Fh) | kafka.m7g.2xlarge ($0.44\u002Fh) | ~20% | Same 8 vCPU \u002F 32 GB |\n| kafka.m5.4xlarge ($1.104\u002Fh) | kafka.m7g.4xlarge ($0.88\u002Fh) | ~20% | Same 16 vCPU \u002F 64 GB |\n| kafka.c5.large (legacy) | kafka.m7g.large | ~15% | c5 → m7g class change |\n\nWorked example (Graviton migration savings math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the migration matrix above to reproduce it.\n\n### Step 6: MSK Serverless vs provisioned fit evaluation\n\nServerless eliminates broker management and bills per partition-hour +\nper-GB data + per-PUT-hour. The break-even calculation compares total\nprovisioned cost against projected Serverless pricing.\n\n**Break-even logic:**\n\nServerless break-even calculation block: moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nBreak-even heuristic: below ~50 MB\u002Fs sustained ingress Serverless is usually cheaper.\n\nA rough heuristic: if the provisioned cluster's total sustained ingress\nis below ~50 MB\u002Fs, or if the cluster idles for extended periods,\nServerless is likely cheaper. Above 50 MB\u002Fs steady, provisioned with\nGraviton brokers is cheaper.\n\n| Provisioned profile | Recommendation | Rationale |\n|---|---|---|\n| Ingress \u003C 50 MB\u002Fs, variable load | Migrate to Serverless | Pay only for partitions + data |\n| Ingress \u003C 50 MB\u002Fs, steady, few partitions | Evaluate Serverless | Break-even zone; compute 30-day cost |\n| Ingress > 50 MB\u002Fs steady | Keep provisioned + Graviton | Provisioned cheaper at scale |\n| > 1000 partitions | Keep provisioned | Serverless per-partition-hour adds up |\n| Dev\u002Ftest, idle nights\u002Fweekends | Migrate to Serverless | Near-zero cost when idle |\n\nWorked example (Serverless vs provisioned math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the fit table above to reproduce it.\n\n### Step 7: Broker count optimisation\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| Broker count=6, total ingress \u003C 50 MB\u002Fs, partitions \u003C 120 | Reduce to 3 brokers (blue\u002Fgreen migration) | ~50% of compute |\n| Broker count=3, ingress > 50 MB\u002Fs, consumer lag growing | Add brokers (scale out) | None — capacity-bound |\n| Broker count=3 (minimum for HA) | Keep; cannot reduce below 3 | None |\n| Broker count > 3 with replication factor=3 | Evaluate reducing to 3 if throughput allows | Per excess broker |\n\nWorked example (6-to-3 broker reduction math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the observation table above to reproduce it.\n\n### Step 8: EBS storage optimisation\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| KafkaDataLogsDiskUsed avg \u003C 30% on 1 TB+ volumes | Reduce volume on next blue\u002Fgreen | Per-GB-month saved |\n| KafkaDataLogsDiskUsed growing > 10%\u002Fmonth | Enable MSK storage auto-expand | Prevents volume exhaustion |\n| Fixed volume with predictable growth | Evaluate auto-expand vs manual right-size | Operational savings |\n| Volume per broker > 2x the data need | Right-size to 1.3x actual usage | ~35% of EBS cost |\n\nWorked example (EBS volume right-sizing math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the observation table above to reproduce it.\n\n### Step 9: Data retention and compaction optimisation\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| Retention > 168h on high-throughput non-compacted topic | Reduce to 24-72h if replay not needed | Up to 7x storage |\n| Compaction candidate (changelog, event-sourcing) with time retention | Switch to cleanup.policy=compact | 10x storage reduction |\n| Mixed retention policy, some topics overly long | Audit topic-level configs; standardise | Variable |\n| Retention = -1 (infinite) on any topic | Set finite retention immediately | Prevents unbounded growth |\n\nWorked example (retention and compaction math): moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nApply the observation table above to reproduce it.\n\n### Step 10: Partition count right-sizing\n\n| Observation | Recommendation | Savings |\n|---|---|---|\n| > 400 partitions\u002Fbroker with low throughput\u002Fpartition | Consolidate partitions (operational) | Enables broker downsize |\n| 1000 partitions for a 1 MB\u002Fs workload | Reduce to 12-24 partitions | Frees broker CPU |\n| Uneven partition distribution | Reassign partitions (kafka-reassign-partitions) | Performance, not cost |\n| Consumer group reading from few partitions | Reduce partition count to match consumer parallelism | Enables downsize |\n\nPartition right-sizing has no direct cost savings, but reducing\nexcessive partitions frees broker CPU and memory, which can then enable\na broker type downsize. This is a force-multiplier for Step 4.\n\n### Step 11: Final verdict\n\nThe verdict is the worst-case (most-actionable) finding across all\nseven dimensions:\n\n- If ANY dimension has a concrete recommendation with quantified\n  savings, verdict is **OPPORTUNITY_FOUND**.\n- If a change was applied and verified this session, verdict is\n  **OPTIMIZED**.\n- If all dimensions are at cost-optimal config AND broker count,\n  retention, and Serverless fit have been evaluated, verdict is\n  **ALREADY_OPTIMAL**.\n\n## Output format\n\n### Worked example — multi-dimension opportunity\n\n```text\nTARGET: events-prod-msk\nVERDICT: OPPORTUNITY_FOUND\nREASON: Cluster runs kafka.m5.large (pre-Graviton) with 6 brokers,\n  1 TB EBS per broker at 25% disk used, 168h retention on a\n  high-throughput topic that only needs 24h, total ingress 15 MB\u002Fs\n  (well under the 50 MB\u002Fs Serverless break-even candidate range),\n  and Kafka 3.5.1 (Graviton-ready). Five dimensions have actionable\n  opportunities.\nRECOMMENDATION:\n  Current:\n    Brokers: 6 x kafka.m5.large ($0.276\u002Fh) = $1,209\u002Fmonth\n    EBS: 6 x 1 TB gp3 = $480\u002Fmonth\n    Retention: 168h (7 days) on events topic\n    Partitions: 120 across 15 topics\n    Pricing: On-Demand (no commit)\n  Proposed:\n    - Graviton migration: kafka.m5.large -> kafka.m7g.large ($0.22\u002Fh,\n      20% cheaper). Kafka 3.5.1 supports Graviton.\n    - Broker count: reduce 6 -> 3 brokers (blue\u002Fgreen migration).\n      Total ingress 15 MB\u002Fs is 5 MB\u002Fs\u002Fbroker on 3 brokers — well within\n      capacity. Partition ratio 40\u002Fbroker (under 400 ceiling).\n    - EBS: reduce 1 TB -> 500 GB per broker on new cluster (disk used\n      is 25% = 250 GB; 500 GB gives 2x headroom). Enable auto-expand.\n    - Retention: reduce events topic from 168h -> 24h (data-replay\n      requirement is 24h).\n    - Combined: migrate to kafka.m7g.large x 3 brokers with 500 GB EBS\n      and 24h retention in a single blue\u002Fgreen migration.\n  Confidence: HIGH — CloudWatch confirms low disk utilisation; CE\n    confirms On-Demand spend with no discount; Kafka version supports\n    Graviton.\nESTIMATED_SAVINGS:\n  Monthly (Graviton migration): $122  (3 x ($0.276-$0.22) x 730)\n  Monthly (broker count 6->3): $604   (3 x $0.276 x 730)\n  Monthly (EBS 1TB->500GB): $120      (3 x 500GB x $0.08)\n  Monthly (retention 168h->24h): $411 (storage delta on events topic)\n  Annual total: $15,084\n  Assumptions: us-east-1 pricing, 730h\u002Fmonth, all changes applied via\n    blue\u002Fgreen migration to a new cluster.\nMIGRATION_STEPS:\n  1. Snapshot current topic configurations and consumer group offsets:\n     aws kafka describe-cluster-v2 --cluster-arn $CLUSTER_ARN\n     # Record partition count, replication factor, retention per topic\n  2. Create the new MSK cluster with optimised config:\n     aws kafka create-cluster-v2 \\\n       --cluster-name events-prod-msk-v2 \\\n       --provisioned '{\"BrokerNodeGroupInfo\":{\\\n         \"InstanceType\":\"kafka.m7g.large\",\\\n         \"BrokerCount\":3,\\\n         \"StorageInfo\":{\"VolumeSize\":500}},\\\n         \"KafkaVersion\":\"3.5.1\"}'\n  3. Set retention to 24h on the events topic in the new cluster:\n     kafka-configs --bootstrap-server $NEW_BROKERS \\\n       --alter --topic events \\\n       --add-config retention.ms=86400000\n  4. Sync data via MirrorMaker2 or MSK Cluster Linking:\n     # Start MirrorMaker2 to replicate topics from old -> new cluster\n  5. Cut over producers and consumers to the new cluster.\n  6. Verify BytesInPerSec, KafkaDataLogsDiskUsed, and MaxOffsetLag\n     are stable for 7 days on the new cluster.\n  7. Decommission the old cluster:\n     aws kafka delete-cluster --cluster-arn $OLD_CLUSTER_ARN\nCONFIRM: Before each state-changing CLI, emit and await operator\n  approval. Stage the blue\u002Fgreen migration with monitoring between\n  each step; never batch the cut-over + decommission.\n```\n\n### Worked example — already optimal\n\nFull worked example for an ALREADY_OPTIMAL verdict: moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nThe multi-dimension example above is the primary contract demonstration.\n\n## Anti-Patterns — NEVER do these things\n\n- **NEVER recommend reducing MSK broker count below 3.** Kafka requires\n  a minimum of 3 brokers for replication factor=3 and quorum-based\n  fault tolerance. A 2-broker cluster cannot survive a single broker\n  failure without data loss. Always retain at least 3 brokers for HA.\n\n- **NEVER recommend Graviton brokers without confirming Kafka version\n  3.x+.** Kafka 2.x does not support Graviton (m7g\u002Fm6g) broker types.\n  Recommending Graviton on a Kafka 2.x cluster without first planning\n  the version upgrade will fail at cluster creation.\n\n- **NEVER recommend decreasing EBS volume size in-place.** MSK supports\n  online EBS volume increases via update-broker-storage, but NOT\n  decreases. Decreasing EBS requires cluster recreation via blue\u002Fgreen\n  migration. Always flag EBS reduction for the next migration, not as\n  an immediate action.\n\n- **NEVER recommend MSK Serverless for a workload exceeding 50 MB\u002Fs\n  sustained ingress without computing the full break-even.** Serverless\n  per-partition-hour + per-GB data pricing exceeds provisioned broker\n  cost at high sustained throughput. Always compute the 30-day projected\n  Serverless cost and compare against provisioned + Graviton cost.\n\n- **NEVER recommend reducing log retention without confirming the\n  data-replay requirement.** Consumers may depend on historical data\n  for batch processing, backfill, or audit. Always confirm the required\n  replay window before shortening retention. For audit requirements,\n  consider exporting to S3 before reducing Kafka-side retention.\n\n- NEVER recommend switching a topic to cleanup.policy=compact without\n  confirming the topic is key-based. Compaction on a topic with null\n  keys or append-only events will delete data unpredictably.\n- NEVER recommend adding partitions to solve a throughput problem\n  without checking the consumer parallelism first. More partitions add\n  broker overhead; if consumers can't parallelise, the partitions are\n  wasted cost.\n- NEVER batch a blue\u002Fgreen migration's cut-over and decommission in\n  one step. Always cut over, verify for 7 days, then decommission the\n  old cluster.\n- NEVER purchase a 3-year commitment on a cluster with active migration\n  plans. The commitment outlasts the cluster. Match commit term to\n  expected cluster lifetime.\n- NEVER recommend MSK Express tier for a steady-state workload. Express\n  burst credits deplete under sustained load; Express is for variable-\n  throughput workloads that burst occasionally.\n\n## Quick navigation\n\n| You want to... | Jump to |\n|---|---|\n| Evaluate Graviton migration (m5 -> m7g) | Step 5 — Graviton migration |\n| Right-size broker type | Step 4 — Broker right-sizing |\n| Reduce broker count (6 -> 3) | Step 7 — Broker count optimisation |\n| Evaluate MSK Serverless vs provisioned | Step 6 — Serverless fit |\n| Optimise EBS storage | Step 8 — EBS storage optimisation |\n| Reduce log retention \u002F enable compaction | Step 9 — Retention and compaction |\n| Reduce excessive partitions | Step 10 — Partition right-sizing |\n| Handle missing data | Step 1 — Validate input |\n| Look up pricing \u002F broker types | references\u002Fmsk-pricing-reference.md |\n\n## Expert heuristic — the 60-second triage\n\nThe 60-second triage (six checks to run when handed an MSK bill): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nIf any check hits, deep-dive the corresponding Process step.\n\n## Pre-flight safety checks (run before any remediation CLI)\n\nPre-flight safety checks (confirmation gate, state recording, one-dimension-per-window, post-change verification, blue\u002Fgreen migration, 3-cluster batch limit): moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nNEVER omit the CONFIRM gate — see FORBIDDEN output patterns above.\n\n## Verdict semantics\n\n| Verdict | When to emit | Position in workflow |\n|---|---|---|\n| `OPPORTUNITY_FOUND` | At least one dimension has a savings-bearing recommendation. | Primary — terminal for actionable findings. |\n| `OPTIMIZED` | A change was applied and verified this session; CE line items confirm the new pattern. | Primary — only emitted post-remediation. |\n| `ALREADY_OPTIMAL` | All seven dimensions at cost-optimal config AND broker count, retention, and Serverless fit evaluated. | Primary — terminal for healthy findings. |\n| `NEED_MORE_INFO` | Data gate failed: CE access denied, CloudWatch window \u003C 14 days, Kafka version unknown. | Pre-decision — emit per-dimension; other dimensions can still emit OPPORTUNITY_FOUND. |\n\n## Recent AWS features (2024-2026)\n\nRecent AWS features (2024-2026): moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nCheck before recommending Express tier, KRaft, or the newest broker types.\n\n## AWS documentation\n\nDomain: AWS CloudOps \u002F Analytics — Amazon MSK cost optimisation.\n\n- **Amazon MSK pricing** — https:\u002F\u002Faws.amazon.com\u002Fmsk\u002Fpricing\u002F\n- **MSK Serverless** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fserverless.html\n- **MSK broker types** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fmsk-create-cluster.html\n- **MSK Cluster Tier (Express)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fsupported-broker-types.html\n- **MSK with KRaft** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fkraft.html\n- **MSK storage** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fmsk-storage.html\n- **MSK Cluster Linking** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fmsk\u002Flatest\u002Fdeveloperguide\u002Fmsk-cluster-linking.html\n- **AWS Cost Explorer** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcost-management\u002Flatest\u002Fuserguide\u002Fce-what-is.html\n- **Well-Architected — Cost Optimization** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fwellarchitected\u002Flatest\u002Fcost-optimization-pillar\u002Fwelcome.html\n\n## References (load on demand)\n\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Step 0 non-obvious behaviours, quick-start heuristics, cost-structure fundamentals, 60-second triage, recent AWS features (2024-2026).\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — Required data-source commands, Step 1\u002FStep 2 command blocks, pre-flight safety checks.\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — Secondary worked examples (right-sizing, Graviton, Serverless break-even, broker count, EBS, retention, already-optimal).\n- [references\u002Fmsk-pricing-reference.md](references\u002Fmsk-pricing-reference.md) — Broker-type pricing, Graviton savings matrix, Serverless pricing, EBS and retention cost projections.\n\n\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},"msk, kafka, analytics, cost-optimization, finops, right-sizing, serverless","3","Jacky Chan — AWS Community Builder","aws-cloudops","Analytics","0.1.0","Amazon MSK, Amazon Managed Streaming for Apache Kafka, MSK Serverless, MSK Express, MSK Cluster Tier, MSK KRaft, Graviton brokers, kafka.m7g, broker right-sizing, EBS storage optimisation, log retention, compacted topics, partition count, consumer lag, KafkaDataLogsDiskUsed, data retention, FinOps, streaming cost","optimize","high","false","capability","Reviewing Amazon MSK cluster spend, right-sizing Kafka broker types, evaluating Graviton brokers (kafka.m7g vs kafka.m5), deciding between MSK Serverless and provisioned (break-even ~50 MB\u002Fs), optimising broker count (minimum 3 for HA, reduce excess), auditing EBS storage allocation vs actual disk usage, tuning log retention hours or compacted topics for storage savings, or evaluating MSK Cluster Tier (Express) and MSK with KRaft for cost.","true","OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL","Self-managed Kafka on EC2 cost optimisation (this skill covers the managed MSK service only), Kafka Connect or MSK Connect cost optimisation (use kafka-connect-troubleshooter or a Connect specialist), Kinesis Data Streams cost optimisation (different service), Kafka performance tuning or partition rebalancing as the primary goal (use a Kafka operations workflow; this skill uses metrics only to identify cost waste), or MSK security or TLS configuration (use a security audit workflow).","active","Input: either (a) an MSK cluster ARN or identifier + live-account context, (b) a cluster configuration document (broker type, broker count, EBS volume size, partition count, retention hours, Kafka version, pricing model, CloudWatch metrics), OR (c) a fleet description for batch optimisation. Output: a deterministic TARGET \u002F VERDICT \u002F REASON \u002F RECOMMENDATION \u002F ESTIMATED_SAVINGS \u002F MIGRATION_STEPS block per cluster, where VERDICT ∈ {OPTIMIZED, OPPORTUNITY_FOUND, ALREADY_OPTIMAL}.","# Minimal valid input (offline classification):\nCluster: events-prod-msk\nKafka Version: 3.5.1\nRegion: us-east-1\nBroker Type: kafka.m5.large (2 vCPU, 8 GB)\nBroker Count: 6\nEBS Volume: 1 TB gp3 per broker\nPartitions: 120 across 15 topics\nLog Retention: 168 hours (7 days)\nCompacted Topics: none\nPricing: On-Demand (no commit)\nCloudWatch metrics (last 30 days):\n  - BytesInPerSec per broker: avg=5, max=12\n  - KafkaDataLogsDiskUsed: avg=25%, max=35%\n  - MaxOffsetLag: avg=1,000 (low consumer lag)\nEmit the standard optimisation block (TARGET, VERDICT, REASON,\nRECOMMENDATION, ESTIMATED_SAVINGS, MIGRATION_STEPS).","optimise MSK cost, right-size MSK broker, MSK Graviton migration, kafka.m7g vs kafka.m5, MSK Serverless vs provisioned, MSK broker count, MSK EBS storage optimisation, MSK log retention, MSK compacted topics, MSK partition count, MSK Cluster Tier Express, MSK KRaft, MSK consumer lag cost, KafkaDataLogsDiskUsed, reduce MSK bill","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from pasted cluster configuration, CloudWatch summaries, and billing line items. Live-account optimisation uses aws kafka describe-cluster, describe-cluster-v2, list-clusters-v2, aws kafka describe-configuration, aws cloudwatch get-metric-statistics for AWS\u002FKafka BytesInPerSec, BytesOutPerSec, KafkaDataLogsDiskUsed, ConsumerLagMetrics MaxOffsetLag, CpuUser, CpuSystem, aws ce...","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fmsk-cost-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 msk-cost-optimizer",{"tool":59,"command":60},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill msk-cost-optimizer",{"tool":62,"command":63},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill msk-cost-optimizer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-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","参考文档",8280,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Feval\u002Ftest-cases.yaml",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"evals\u002Fbaselines\u002Falready-optimal-graviton-compact-retention.md",638,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fbaselines\u002Falready-optimal-graviton-compact-retention.md",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"evals\u002Fbaselines\u002Fbroker-count-overprovisioned.md",623,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fbaselines\u002Fbroker-count-overprovisioned.md",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"evals\u002Fbaselines\u002Febs-storage-overprovisioned.md",625,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fbaselines\u002Febs-storage-overprovisioned.md",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"evals\u002Fbaselines\u002Fgraviton-broker-migration.md",601,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fbaselines\u002Fgraviton-broker-migration.md",{"path":90,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":91,"sourceHtmlUrl":92},"evals\u002Fbaselines\u002Fmsk-serverless-break-even.md",656,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fbaselines\u002Fmsk-serverless-break-even.md",{"path":94,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":95,"sourceHtmlUrl":96},"evals\u002Feval_config.yaml",1817,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Feval_config.yaml",{"path":98,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":99,"sourceHtmlUrl":100},"evals\u002Fevals.json",4626,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fevals.json",{"path":102,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":103,"sourceHtmlUrl":104},"evals\u002Fprompts\u002Falready-optimal-graviton-compact-retention.md",941,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fprompts\u002Falready-optimal-graviton-compact-retention.md",{"path":106,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":107,"sourceHtmlUrl":108},"evals\u002Fprompts\u002Fbroker-count-overprovisioned.md",850,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fprompts\u002Fbroker-count-overprovisioned.md",{"path":110,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":111,"sourceHtmlUrl":112},"evals\u002Fprompts\u002Febs-storage-overprovisioned.md",766,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fprompts\u002Febs-storage-overprovisioned.md",{"path":114,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":115,"sourceHtmlUrl":116},"evals\u002Fprompts\u002Fgraviton-broker-migration.md",868,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fprompts\u002Fgraviton-broker-migration.md",{"path":118,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":119,"sourceHtmlUrl":120},"evals\u002Fprompts\u002Fmsk-serverless-break-even.md",806,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fevals\u002Fprompts\u002Fmsk-serverless-break-even.md",{"path":122,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":123,"sourceHtmlUrl":124},"examples\u002FREADME.md",8862,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Fexamples\u002FREADME.md",{"path":126,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":127,"sourceHtmlUrl":128},"references\u002Fadvanced-patterns.md",8317,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Freferences\u002Fadvanced-patterns.md",{"path":130,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":131,"sourceHtmlUrl":132},"references\u002Fdiagnostic-commands.md",4606,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Freferences\u002Fdiagnostic-commands.md",{"path":134,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":135,"sourceHtmlUrl":136},"references\u002Fmsk-pricing-reference.md",7483,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Freferences\u002Fmsk-pricing-reference.md",{"path":138,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":139,"sourceHtmlUrl":140},"references\u002Fworked-examples.md",4931,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-optimizer\u002Freferences\u002Fworked-examples.md",{"path":142,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":143,"sourceHtmlUrl":144},"skill.usf.yaml",4577,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmsk-cost-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",[],[]]