[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A5M3CQ20KMD3FEP263MQY6":3,"skill-same:01M7A5M3CQ20KMD3FEP263MQY6":144},{"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":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":6,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"01M7A5M3CQ20KMD3FEP263MQY6","cloudwatch-logs-retention-auditor",null,"Audits CloudWatch Logs log groups for Never-expire retention (silent infinite-cost accumulation), missing SSE-KMS customer-managed-key (CMK) encryption, excessive-retention × volume cost exposure, subscription filter fan-out (Lambda\u002FKinesis\u002FCross-account destination), missing metric filters, and absent CloudWatch Logs Anomaly Detectors. Emits a deterministic first-fail-wins verdict (NO_RETENTION | NO_ENCRYPTION | COST_RISK | CONFIG_GAP | OK) per log group with enumerated findings and CLI remediation. Use when reviewing CloudWatch Logs posture, auditing log group retention, validating KMS CMK encryption, hunting for runaway cost on Never-expire groups, checking metric-filter \u002F anomaly-detector observability coverage, or hardening log-group posture before compliance review.","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\u002Fcloudwatch-logs-retention-auditor\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cloudwatch-logs-retention-auditor\ndescription: Audits CloudWatch Logs log groups for Never-expire retention (silent infinite-cost accumulation), missing SSE-KMS customer-managed-key (CMK) encryption, excessive-retention × volume cost exposure, subscription filter fan-out (Lambda\u002FKinesis\u002FCross-account destination), missing metric filters, and absent CloudWatch Logs Anomaly Detectors. Emits a deterministic first-fail-wins verdict (NO_RETENTION | NO_ENCRYPTION | COST_RISK | CONFIG_GAP | OK) per log group with enumerated findings and CLI remediation. Use when reviewing CloudWatch Logs posture, auditing log group retention, validating KMS CMK encryption, hunting for runaway cost on Never-expire groups, checking metric-filter \u002F anomaly-detector observability coverage, or hardening log-group posture before compliance review.\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline config classification. Live-account audits use aws logs describe-log-groups, describe-metric-filters, describe-subscription-filters, describe-anomaly-detectors, and aws kms describe-key (AWS CLI v2, SSO or key-based credentials).\nmetadata:\n  domain: aws-cloudops\n  complexity: medium\n  requires_llm: 'true'\n  phase: '2'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Management\n  verdict_shape: NO_RETENTION | NO_ENCRYPTION | COST_RISK | CONFIG_GAP | OK\n  when_to_use: Pre-compliance review of CloudWatch Logs log groups, Never-expire retention audits, KMS CMK encryption verification, runaway log cost investigations, metric-filter \u002F anomaly-detector coverage audits, or hardening log-group posture before production cutover.\n  activation_triggers: audit this CloudWatch Logs group, is my log group retention set, Never expire log group, check CloudWatch Logs cost, is CloudWatch Logs encrypted with KMS, are metric filters configured, is anomaly detection enabled, subscription filter audit, CloudWatch Logs compliance check, log group cost risk\n  invocation_schema: 'Input: either (a) describe-log-groups output (JSON or key-value summary) for one log group, optionally paired with describe-metric-filters, describe-subscription-filters, and describe-anomaly-detectors output, OR (b) a log-group name\u002FARN for live-account audit. Output: deterministic LOG_GROUP\u002FVERDICT\u002FREASON\u002F FINDINGS\u002FREMEDIATION block per log group, where VERDICT ∈ {NO_RETENTION, NO_ENCRYPTION, COST_RISK, CONFIG_GAP, OK, ERROR}.'\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: CloudWatch Logs, log group retention, Never expire, retentionInDays, SSE-KMS, customer-managed key, kmsKeyId, metric filter, subscription filter, anomaly detector, CloudWatch Logs Insights, storedBytes, PutRetentionPolicy, AssociateKmsKey, PutMetricFilter, PutSubscriptionFilter, log cost audit, infinite retention, compliance retention, observability gap\n  tags: cloudwatch-logs, management, retention, cost, kms-encryption, metric-filters, anomaly-detection, audit\n---\n\n# CloudWatch Logs Retention & Cost Auditor\n\n## Mindset\n\n**One-line takeaway:** the verdict is the **first** failing dimension in\na strict first-fail-wins order — retention before encryption, encryption\nbefore cost risk, cost risk before observability config gap. A log group\nwith `retentionInDays` absent (Never expire) fails the most fundamental\ngate regardless of how well everything else is configured.\n\nCloudWatch Logs is the default sink for application, Lambda, and\ncontainer logs. The pricing model is silent and additive — ingestion,\nstorage, and Insights queries bill continuously until you set a\nretention. A log group left at the **default Never-expire retention** is\nthe single most common source of unexpected AWS bill surprises after\nidle EC2 and untagged S3.\n\nThree CloudWatch Logs behaviors shape every verdict:\n\n- **`retentionInDays` absence means Never expire, NOT 0 or default-30.**\n  `describe-log-groups` simply omits the field. A null-check (not a\n  truthy-check) is required.\n- **SSE at rest is on by default, but with a CloudWatch service-managed\n  key, not a customer-managed KMS key (CMK).** Absence of `kmsKeyId`\n  is NOT \"unencrypted\" — it is \"no customer-controlled key.\" You cannot\n  audit key usage via CloudTrail, cannot enforce key-policy guardrails,\n  and cannot satisfy CMK-mandated compliance frameworks (FedRAMP,\n  HIPAA-with-BAA-controls, SOC 2 Type II with CMK mandate).\n- **`storedBytes` is a cumulative counter since log-group creation, not\n  current storage.** A 3-year-old group with `storedBytes: 2 TB` may\n  currently hold only 5 GB if retention is 30 days.\n\n## Quick reference — verdict matrix\n\n| Dimension checked | Fail verdict | Risk | Step |\n|---|---|---|---|\n| `retentionInDays` absent \u002F null \u002F 0 | **NO_RETENTION** | CRITICAL | 1 |\n| `kmsKeyId` absent \u002F null \u002F empty | **NO_ENCRYPTION** | HIGH | 2 |\n| Cost threshold crossed (see COST_RISK table below) | **COST_RISK** | HIGH | 3 |\n| No metric filters AND\u002FOR no anomaly detector | **CONFIG_GAP** | MEDIUM | 4 |\n| All dimensions pass | **OK** | LOW | 5 |\n\nThe first matching row is the verdict — do NOT continue to lower rows\nonce one fires. Findings from later dimensions are still enumerated in\nthe FINDINGS block but cannot upgrade the verdict.\n\n**COST_RISK thresholds (Step 3 — first matching row fires):**\n\n| # | Condition | Why |\n|---|---|---|\n| 3a | `retentionInDays >= 3653` | API maximum (~10 years); almost no workload justifies this — usually a copy-paste from a \"7-year\" template rounded up. Fires regardless of volume. |\n| 3b | `retentionInDays >= 731` AND `storedBytes >= 10 GB` | 2+ year retention on a non-trivial group; current storage cost is material. |\n| 3c | `retentionInDays >= 365` AND `storedBytes >= 100 GB` | Year-plus retention on a high-volume group; storage + Insights query costs compound. |\n| 3d | `retentionInDays >= 90` AND a Lambda subscription filter is active on the group | Lambda invocation cost on a high-volume group frequently exceeds the CloudWatch Logs storage charge — the filter is a cost multiplier. |\n\n**Risk labels (used in FINDINGS):** CRITICAL = unbounded cost or\nirrecoverable data loss; HIGH = bounded but material cost or auditability\ngap; MEDIUM = observability gap, no cost\u002Fsecurity impact; LOW = clean\nposture. The verdict's risk is the risk of the first failing dimension.\n\n**`storedBytes` fallback when `creationTime` is unavailable:** use\n`storedBytes` directly as a worst-case upper bound (treat as current\nstorage). When `creationTime` IS available, estimate daily ingestion as\n`storedBytes \u002F ageInDays` and project current storage as\n`(storedBytes \u002F ageInDays) * retentionInDays` — typically 2-10x smaller\nthan the raw `storedBytes` reading.\n\n**Critical NEVER summary** (full list in Anti-Patterns section):\n\n- NEVER treat absence of `retentionInDays` as a default — it means Never\n  expire (NO_RETENTION, CRITICAL).\n- NEVER assume SSE-KMS CMK is in use because \"CloudWatch Logs is\n  encrypted at rest\" — the default is a CloudWatch service-managed key,\n  not a CMK. Absence of `kmsKeyId` is NO_ENCRYPTION (HIGH).\n- NEVER classify a `retentionInDays`-absent group as NO_ENCRYPTION or\n  COST_RISK — first-fail-wins terminates at NO_RETENTION regardless of\n  what else is missing.\n\n## Pre-flight: log group metadata gate\n\n**Account-wide sweep note (pagination):** `aws logs describe-log-groups`\nreturns at most 50 per page; `describe-metric-filters`,\n`describe-subscription-filters`, and `describe-anomaly-detectors` each\npage independently at the same cap. Use `--starting-token` from the prior\n`nextToken` to drain all pages — iterating only the first page silently\nskips the long tail of stale Never-expire groups.\n\n| Field | Value | Effect |\n|---|---|---|\n| `retentionInDays` | absent | **Never expire.** Highest-priority finding. Jump to Step 1. |\n| `retentionInDays` | `1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,2192,2557,2922,3288,3653` | Valid values. Any other value is rejected at `PutRetentionPolicy` time — if observed, the snapshot is stale; re-fetch. |\n| `kmsKeyId` | absent | **SSE with CloudWatch service-managed key** (still encrypted at rest, no CMK). NO_ENCRYPTION applies (Step 2). |\n| `kmsKeyId` | ARN present | **SSE-KMS with CMK.** Verify region matches the log group region; cross-region CMK is rejected. |\n| `storedBytes` | integer | **Cumulative counter since creation** — never decreases. Use `storedBytes \u002F ageInDays` to estimate average daily ingestion. |\n| Subscription filter count | `0,1,2` | Quota is **2 per group** (raised from 1 in 2020). A third `PutSubscriptionFilter` returns `LimitExceededException`; producers are not notified and silently drop the fan-out. |\n\n**If input is unparseable** (invalid JSON, missing `logGroupName`,\ntruncated output), output:\n\n```text\nLOG_GROUP: \u003Cname-or-arn>\nVERDICT: ERROR\nREASON: Log group metadata is malformed — cannot classify. Missing field: \u003Cfield>.\nREMEDIATION: Re-fetch with `aws logs describe-log-groups --log-group-name-prefix \u003Cname> --output json` and re-audit.\n```\n\n## Process — Classification logic (first-fail-wins, in order)\n\n### Step 0: Expert knowledge — non-obvious CloudWatch Logs behaviors\n\nStep 0 expert-knowledge deep dive (no default retention, new-events-only retention changes, CMK KMS-request cost, no AWS-managed key path, 2-filter subscription quota, metric-filter no-backfill, anomaly 14-day baseline, cross-account destinations, prefix-vs-exact matching, storedBytes monotonicity, Insights per-GB billing, PutLogEvents batch limits, KMS region match, no rename, ARN :* suffix, non-retroactive AssociateKmsKey, IaC silent Never-expire, 5 TPS control-plane throttle, DLQ-less fan-out, per-detector cost) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad it before classifying edge-case inputs or pricing a CMK recommendation.\n\n### Step 1: Never-expire retention (highest priority — silent infinite cost)\n\nIf `retentionInDays` is absent, null, or 0, the log group **never\nexpires**. Verdict: **NO_RETENTION** (CRITICAL).\n\n- Storage accumulates at the Published-Log-Storage Per-GB-month rate\n  indefinitely. A 10 GB\u002Fmonth ingestion group costs ~$50\u002Fmonth in\n  storage after 1 year, ~$500\u002Fmonth after 2 years — unbounded.\n- Most compliance frameworks (SOC 2, PCI-DSS v4, ISO 27001, FedRAMP)\n  require **defined** retention. A Never-expire group is a control\n  deficiency even when \"we want to keep everything\" — the absence of\n  a documented decision is the finding.\n- Remediation is `aws logs put-retention-policy --log-group-name\n  \u003Cname> --retention-in-days \u003CN>`. The CLI does NOT prompt.\n\n**Why highest priority:** a Never-expire group with no CMK and no\nmetric filters is unambiguously NO_RETENTION (first-fail-wins). The\nabsence of retention is the loudest signal; encryption and observability\ngaps compound but cannot override it.\n\n### Step 2: SSE-KMS CMK encryption\n\nIf `kmsKeyId` is absent, null, or empty, the log group uses CloudWatch\nservice-managed encryption (SSE at rest is on, no CMK). Verdict:\n**NO_ENCRYPTION** (HIGH).\n\n- Without a CMK, you cannot audit key usage via CloudTrail\n  `kms:Decrypt` events for log access.\n- Most regulated workloads (FedRAMP, HIPAA BAA controls, SOC 2 Type\n  II with CMK mandate, PCI-DSS v4 requirement 3.5) require a\n  **customer-controlled** key for log data at rest.\n- Remediation is `aws logs associate-kms-key --log-group-name \u003Cname>\n  --kms-key-id \u003Ckey-arn>`. The key policy MUST permit\n  `logs.\u003Cregion>.amazonaws.com` to call `kms:GenerateDataKey` and\n  `kms:Decrypt` — without this, PutLogEvents\u002FGetLogEvents fail with\n  `AccessDeniedException`.\n\n**Why HIGH not CRITICAL:** SSE at rest is on by default; the gap is\ncustomer-controlled key auditability, not plaintext storage. CRITICAL is\nreserved for active data-loss or infinite-cost vectors (NO_RETENTION).\n\n### Step 3: Cost-risk retention × volume profile\n\nIf retention IS set AND a CMK IS associated, evaluate the retention ×\nvolume profile against the **COST_RISK thresholds** (table in the Quick\nReference above). The first matching row (3a → 3d) fires COST_RISK; do\nnot continue evaluating lower-priority rows once one fires.\n\n**Required inputs:** `retentionInDays`, `storedBytes`, `creationTime`\n(for the daily-ingestion estimate). If `creationTime` is missing, fall\nback to treating `storedBytes` as current storage (worst-case upper\nbound) — note the fallback in FINDINGS. If `storedBytes` is also\nmissing, the cost dimension cannot be classified and the verdict skips\nto Step 4 with a `DATA_MISSING` note.\n\n**Lambda subscription-filter cost caveat (Row 3d):** the threshold\nfires only for Lambda destinations, NOT for Kinesis Data Streams or\nFirehose — Kinesis\u002FFirehose bill by ingestion shard \u002F delivery stream,\nnot per-event invocation, so their cost profile does not multiply with\nevent volume the way Lambda does.\n\n**Why below NO_ENCRYPTION:** cost risk is bounded (retention value caps\nit); CMK absence is an unbounded auditability gap that scales with the\nvolume of regulated data flowing through the group.\n\n### Step 4: Observability config gap\n\nIf retention, encryption, and cost profile are all OK, evaluate\nobservability coverage. **CONFIG_GAP** fires when ANY of these is true:\n\n- **No metric filters** configured. Without metric filters, you cannot\n  build CloudWatch alarms on log content (error rate, latency, auth-\n  failure spikes). Baseline observability gap.\n- **No CloudWatch Logs Anomaly Detector** on the group. Anomaly\n  detectors catch unknown-unknowns (sudden pattern shifts) that fixed\n  metric filters cannot.\n- **Anomaly Detector exists but `Status: TRAINING` OR created \u003C 14\n  days ago.** A training detector produces no findings — treat as\n  CONFIG_GAP with the training caveat in REMEDIATION.\n\n**Why below COST_RISK:** a config gap does not cost money or expose\ndata — it leaves you blind to events the logs already recorded.\n\n### Step 5: All dimensions pass — OK\n\nIf retention is set to a sane value, a CMK is associated, the cost\nprofile is reasonable, and at least one metric filter OR anomaly\ndetector is present, verdict: **OK**.\n\nNote in FINDINGS which dimensions passed and any defense-in-depth\nrecommendations.\n\n## Output format (per log group)\n\n```text\nLOG_GROUP: \u003Cname-or-arn>\nVERDICT: NO_RETENTION | NO_ENCRYPTION | COST_RISK | CONFIG_GAP | OK\nREASON: \u003C1-2 sentences citing the first failing dimension and step number>\nFINDINGS:\n  - [CRITICAL] \u003Cfinding description (Step N)>\n  - [HIGH] \u003Cfinding description (Step N)>\n  - [OK] \u003Cdimension that passed>\nREMEDIATION: \u003Cspecific CLI per finding, or \"None required\" if OK>\n```\n\n### Worked example — Never-expire with no CMK\n\n```text\nLOG_GROUP: \u002Faws\u002Flambda\u002Fprod-checkout-api\nVERDICT: NO_RETENTION\nREASON: retentionInDays is absent — the log group Never expires, accumulating\nstorage cost indefinitely (Step 1). kmsKeyId is also absent (Step 2 finding)\nbut first-fail-wins terminates at Step 1.\nFINDINGS:\n  - [CRITICAL] retentionInDays absent (Never expire) — unbounded storage cost\n    and undefined retention for compliance (Step 1)\n  - [HIGH] kmsKeyId absent — CloudWatch service-managed key only; no CMK\n    auditability (Step 2, suppressed by first-fail-wins but reported)\n  - [OK] logGroupArn includes ':*' suffix — resource-level IAM policies match\nREMEDIATION:\n  1. Set retention: aws logs put-retention-policy --log-group-name\n     \u002Faws\u002Flambda\u002Fprod-checkout-api --retention-in-days 90.\n  2. Associate CMK: aws logs associate-kms-key --log-group-name\n     \u002Faws\u002Flambda\u002Fprod-checkout-api --kms-key-id\n     arn:aws:kms:us-east-1:111111111111:key\u002Fabc-123. Ensure key policy\n     permits logs.us-east-1.amazonaws.com to kms:GenerateDataKey + Decrypt.\n```\n\n### Worked example — malformed input (ERROR path)\n\nWorked example — malformed input (ERROR path) moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nLoad it when describe-log-groups output is truncated or required fields are missing.\n\n## Edge-case handling\n\nEdge-case catalog (`retentionInDays: 0` literal, AWS service-created groups, OpenSearch filter quota bypass, kmsKeyId referencing a deleted key, empty metric-filter pattern, subscription filter on a Never-expire group, TRAINING anomaly detector) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad it when the audit input does not match the mainline Step 1-5 paths.\n\n## Anti-Patterns — NEVER\n\n- NEVER treat absence of `retentionInDays` as \"default 30 days\" or\n  \"default retention\". CloudWatch Logs has NO default retention —\n  absence means Never expire, the highest-severity cost finding.\n\n- NEVER classify a `retentionInDays`-absent group as NO_ENCRYPTION or\n  COST_RISK. First-fail-wins: NO_RETENTION is the verdict. Encryption\n  and cost findings may be enumerated in FINDINGS but cannot override.\n\n- NEVER assume SSE-KMS is in use because \"CloudWatch Logs is encrypted\n  at rest.\" The default is a CloudWatch service-managed key, not a\n  customer-managed CMK. The `kmsKeyId` field must be present for OK at\n  Step 2; absence is NO_ENCRYPTION.\n\n- NEVER confuse `storedBytes` with current storage. It is a cumulative\n  counter since log-group creation that never decreases. Always pair\n  with retention and age.\n\n- NEVER recommend associating a CMK without noting the KMS-request\n  cost impact. Every PutLogEvents batch triggers\n  `kms:GenerateDataKey`. For high-volume groups this can cost more\n  than the CloudWatch Logs ingestion itself.\n\n- NEVER recommend `aws logs delete-log-group` as remediation for\n  excessive storage. It destroys all historical logs irreversibly and\n  the producer will recreate the group on the next PutLogEvents. The\n  correct remediation is `PutRetentionPolicy` to a sane value;\n  deletion is reserved for genuinely decommissioned groups.\n\n- NEVER assume shortening retention immediately deletes historical\n  events. Retention changes apply only to events received AFTER the\n  PutRetentionPolicy call. If the goal is immediate data cleansing,\n  you must delete log streams or the log group — both destructive.\n\n- NEVER treat metric filters as retroactive. They process events\n  received AFTER creation only. Pair with an anomaly detector if\n  retroactive signal is needed (and accept the 2-week training delay).\n\n- NEVER overlook the 2-subscription-filter-per-group quota. A third\n  `PutSubscriptionFilter` fails with `LimitExceededException`. If you\n  need 3+ destinations, aggregate via Kinesis Data Streams or Firehose.\n\n- NEVER classify a group as OK if the only observability signal is an\n  anomaly detector in `TRAINING` status. Treat as CONFIG_GAP until it\n  has 14 days of baseline.\n\n- NEVER recommend a CMK from another region. CloudWatch Logs requires\n  an in-region key. For multi-Region keys, reference the in-region\n  replica ARN.\n\n- NEVER assume `--log-group-name-prefix` is an exact match. It is a\n  prefix — `\u002Faws\u002Flambda` matches `\u002Faws\u002FlambdaFoo`. Use\n  `--log-group-name` (no `prefix`) for exact match in CLI v2.\n\n- NEVER skip paginating `describe-log-groups`,\n  `describe-metric-filters`, `describe-subscription-filters`, or\n  `describe-anomaly-detectors`. Each caps at 50 per page. Iterating\n  only the first page silently misses the long-tail groups.\n\n- NEVER audit a subscription filter without also auditing the\n  destination policy (for cross-account destinations). The destination\n  policy IS the security boundary.\n\n- NEVER classify COST_RISK based on `retentionInDays` alone. Retention\n  × volume is the cost function; a 3653-day retention on 1 MB is\n  cheaper than 30-day retention on 1 TB. Always pair retention with\n  `storedBytes` and `creationTime`.\n\n## Pre-flight safety checks (run before any remediation CLI)\n\nPre-flight safety checks (CONFIRMATION GATE, filter backup, allowed retention values, CMK region\u002Fpolicy verification, KMS cost tolerance, DeleteLogGroup guard, destination-policy audit, additive-first) moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nLoad it before emitting any remediation CLI.\n\n## Remediation guidance\n\n### For NO_RETENTION (Step 1)\n\n1. Set retention matching the workload's compliance window:\n   ```bash\n   aws logs put-retention-policy --log-group-name \u003Cname> \\\n     --retention-in-days 90 --profile \u003Cp>\n   ```\n2. Choose the value by intent, not default:\n   - 14-30 days for operational\u002Fdebug logs (cheapest).\n   - 90 days for application logs covering one quarter of incident review.\n   - 365 days for security\u002Fcompliance logs (SOC 2, ISO 27001 standard).\n   - 731+ days only with documented regulatory requirement (PCI-DSS\n     1-year, HIPAA 6-year, financial-services 7-year).\n3. Verify: `aws logs describe-log-groups --log-group-name-prefix \u003Cname>\n   --query 'logGroups[0].retentionInDays'`.\n4. Note the legacy-events caveat: existing events expire on their\n   original schedule, not immediately.\n\n### For NO_ENCRYPTION (Step 2)\n\n1. Identify an in-region CMK:\n   ```bash\n   aws kms describe-key --key-id \u003Ckey-id> --profile \u003Cp>\n   # Confirm Origin: AWS_KMS, KeyState: Enabled, KeyManager: CUSTOMER,\n   # and the region in the ARN matches the log group region.\n   ```\n2. Attach a key policy permitting CloudWatch Logs:\n   ```json\n   {\n     \"Sid\": \"AllowCloudWatchLogs\",\n     \"Effect\": \"Allow\",\n     \"Principal\": {\"Service\": \"logs.\u003Cregion>.amazonaws.com\"},\n     \"Action\": [\"kms:GenerateDataKey\", \"kms:Decrypt\"],\n     \"Resource\": \"*\",\n     \"Condition\": {\n       \"ArnLike\": {\"aws:SourceArn\": \"arn:aws:logs:\u003Cregion>:\u003Caccount>:log-group:*\"},\n       \"StringEquals\": {\"aws:SourceAccount\": \"\u003Caccount>\"}\n     }\n   }\n   ```\n3. Associate the CMK:\n   ```bash\n   aws logs associate-kms-key --log-group-name \u003Cname> \\\n     --kms-key-id arn:aws:kms:\u003Cregion>:\u003Caccount>:key\u002F\u003Cid> --profile \u003Cp>\n   ```\n4. Verify: `aws logs describe-log-groups --log-group-name-prefix \u003Cname>\n   --query 'logGroups[0].kmsKeyId'`.\n5. Project the KMS-request cost before committing at scale.\n\n### For COST_RISK (Step 3)\n\n1. Shorten retention to the minimum compliance window:\n   ```bash\n   aws logs put-retention-policy --log-group-name \u003Cname> \\\n     --retention-in-days 90 --profile \u003Cp>\n   ```\n2. For high-volume Lambda subscription filters: evaluate replacing\n   synchronous Lambda fan-out with Kinesis Data Streams + enhanced\n   fan-out, or move the consumer to a scheduled Logs Insights query\n   on a data subset.\n3. Archive cold logs to S3 (with S3 lifecycle to Glacier) before\n   shortening retention if regulatory retention requires long-term\n   storage but query frequency is low. Use a Firehose delivery stream\n   with a CloudWatch Logs subscription filter.\n4. Set a CloudWatch alarm on `IncomingBytes` to catch future surges:\n   ```bash\n   aws cloudwatch put-metric-alarm --alarm-name \u003Cname>-ingestion-spike \\\n     --metric-name IncomingBytes --namespace AWS\u002FLogs \\\n     --statistic Sum --period 300 --threshold \u003Cbytes> \\\n     --comparison-operator GreaterThanThreshold --evaluation-periods 1 \\\n     --dimensions Name=LogGroupName,Value=\u003Cname>\n   ```\n\n### For CONFIG_GAP (Step 4)\n\n1. Add at least one metric filter for the primary error signal:\n   ```bash\n   aws logs put-metric-filter --log-group-name \u003Cname> \\\n     --filter-name ErrorCount --filter-pattern '\"ERROR\"' \\\n     --metric-transformations metricName=ErrorCount,metricNamespace=LogMetrics,metricValue=1\n   ```\n2. Add a CloudWatch Logs Anomaly Detector:\n   ```bash\n   aws logs put-anomaly-detector --log-group-arn-list \u003Carn> \\\n     --detector-name \u003Cname>-anomaly --eval-frequency ONE_MIN --profile \u003Cp>\n   ```\n3. Wait 14 days for baseline training. Findings begin only after the\n   baseline is established.\n4. Add an alarm on the anomaly detector:\n   ```bash\n   aws cloudwatch put-metric-alarm --alarm-name \u003Cname>-anomaly-alarm \\\n     --namespace AWS\u002FLogs --metric-name \u003Cdetector-name> \\\n     --dimensions Name=LogGroup,Value=\u003Cname> \\\n     --statistic Sum --period 60 --threshold 0 \\\n     --comparison-operator GreaterThanThreshold --evaluation-periods 1\n   ```\n\n### For OK\n\n1. No remediation required for the current posture.\n2. Defense-in-depth:\n   - Add a second anomaly detector at `FIVE_MIN` for noisier groups.\n   - Add a CloudWatch alarm on `IncomingBytes` for cost-spike detection.\n   - Add a metric filter on `WARN` for early-warning signal.\n   - For multi-account deployments, centralize logs via a cross-account\n     subscription filter to a security-tooling account with a\n     destination policy scoped via `aws:SourceAccount`.\n\n## Recent AWS features (2024-2026)\n\nRecent AWS features 2024-2026 (Infrequent Access log class, account-level data protection policies, data lifecycle to S3\u002FGlacier, subscription filter improvements) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad it when auditing log class, data protection, or lifecycle posture.\n\n## References (load on demand)\n\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Step 0 expert-knowledge deep dive, edge-case catalog, and 2024-2026 AWS features moved from SKILL.md\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight safety checks (confirmation gate, filter backups, KMS cost tolerance) moved from SKILL.md\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — malformed-input ERROR worked example moved from SKILL.md; the primary Never-expire example stays in SKILL.md\n\n## Domain\n\nAWS CloudOps \u002F Management & Governance — CloudWatch Logs cost, security,\nand observability posture.\n\n## AWS documentation\n\n- **Amazon CloudWatch Logs User Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002FWhatIsCloudWatchLogs.html\n- **CloudWatch Logs Security** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002Fsecurity.html\n- **CloudWatch Logs API Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatchLogs\u002Flatest\u002FAPIReference\u002F\n- **AWS CLI Command Reference (logs)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Flogs\u002F\n- **Log class (Standard vs Infrequent Access)** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002FCloudWatch_Logs_LogClasses.html\n","# CloudWatch Logs Retention & Cost Auditor\n\n## Mindset\n\n**One-line takeaway:** the verdict is the **first** failing dimension in\na strict first-fail-wins order — retention before encryption, encryption\nbefore cost risk, cost risk before observability config gap. A log group\nwith `retentionInDays` absent (Never expire) fails the most fundamental\ngate regardless of how well everything else is configured.\n\nCloudWatch Logs is the default sink for application, Lambda, and\ncontainer logs. The pricing model is silent and additive — ingestion,\nstorage, and Insights queries bill continuously until you set a\nretention. A log group left at the **default Never-expire retention** is\nthe single most common source of unexpected AWS bill surprises after\nidle EC2 and untagged S3.\n\nThree CloudWatch Logs behaviors shape every verdict:\n\n- **`retentionInDays` absence means Never expire, NOT 0 or default-30.**\n  `describe-log-groups` simply omits the field. A null-check (not a\n  truthy-check) is required.\n- **SSE at rest is on by default, but with a CloudWatch service-managed\n  key, not a customer-managed KMS key (CMK).** Absence of `kmsKeyId`\n  is NOT \"unencrypted\" — it is \"no customer-controlled key.\" You cannot\n  audit key usage via CloudTrail, cannot enforce key-policy guardrails,\n  and cannot satisfy CMK-mandated compliance frameworks (FedRAMP,\n  HIPAA-with-BAA-controls, SOC 2 Type II with CMK mandate).\n- **`storedBytes` is a cumulative counter since log-group creation, not\n  current storage.** A 3-year-old group with `storedBytes: 2 TB` may\n  currently hold only 5 GB if retention is 30 days.\n\n## Quick reference — verdict matrix\n\n| Dimension checked | Fail verdict | Risk | Step |\n|---|---|---|---|\n| `retentionInDays` absent \u002F null \u002F 0 | **NO_RETENTION** | CRITICAL | 1 |\n| `kmsKeyId` absent \u002F null \u002F empty | **NO_ENCRYPTION** | HIGH | 2 |\n| Cost threshold crossed (see COST_RISK table below) | **COST_RISK** | HIGH | 3 |\n| No metric filters AND\u002FOR no anomaly detector | **CONFIG_GAP** | MEDIUM | 4 |\n| All dimensions pass | **OK** | LOW | 5 |\n\nThe first matching row is the verdict — do NOT continue to lower rows\nonce one fires. Findings from later dimensions are still enumerated in\nthe FINDINGS block but cannot upgrade the verdict.\n\n**COST_RISK thresholds (Step 3 — first matching row fires):**\n\n| # | Condition | Why |\n|---|---|---|\n| 3a | `retentionInDays >= 3653` | API maximum (~10 years); almost no workload justifies this — usually a copy-paste from a \"7-year\" template rounded up. Fires regardless of volume. |\n| 3b | `retentionInDays >= 731` AND `storedBytes >= 10 GB` | 2+ year retention on a non-trivial group; current storage cost is material. |\n| 3c | `retentionInDays >= 365` AND `storedBytes >= 100 GB` | Year-plus retention on a high-volume group; storage + Insights query costs compound. |\n| 3d | `retentionInDays >= 90` AND a Lambda subscription filter is active on the group | Lambda invocation cost on a high-volume group frequently exceeds the CloudWatch Logs storage charge — the filter is a cost multiplier. |\n\n**Risk labels (used in FINDINGS):** CRITICAL = unbounded cost or\nirrecoverable data loss; HIGH = bounded but material cost or auditability\ngap; MEDIUM = observability gap, no cost\u002Fsecurity impact; LOW = clean\nposture. The verdict's risk is the risk of the first failing dimension.\n\n**`storedBytes` fallback when `creationTime` is unavailable:** use\n`storedBytes` directly as a worst-case upper bound (treat as current\nstorage). When `creationTime` IS available, estimate daily ingestion as\n`storedBytes \u002F ageInDays` and project current storage as\n`(storedBytes \u002F ageInDays) * retentionInDays` — typically 2-10x smaller\nthan the raw `storedBytes` reading.\n\n**Critical NEVER summary** (full list in Anti-Patterns section):\n\n- NEVER treat absence of `retentionInDays` as a default — it means Never\n  expire (NO_RETENTION, CRITICAL).\n- NEVER assume SSE-KMS CMK is in use because \"CloudWatch Logs is\n  encrypted at rest\" — the default is a CloudWatch service-managed key,\n  not a CMK. Absence of `kmsKeyId` is NO_ENCRYPTION (HIGH).\n- NEVER classify a `retentionInDays`-absent group as NO_ENCRYPTION or\n  COST_RISK — first-fail-wins terminates at NO_RETENTION regardless of\n  what else is missing.\n\n## Pre-flight: log group metadata gate\n\n**Account-wide sweep note (pagination):** `aws logs describe-log-groups`\nreturns at most 50 per page; `describe-metric-filters`,\n`describe-subscription-filters`, and `describe-anomaly-detectors` each\npage independently at the same cap. Use `--starting-token` from the prior\n`nextToken` to drain all pages — iterating only the first page silently\nskips the long tail of stale Never-expire groups.\n\n| Field | Value | Effect |\n|---|---|---|\n| `retentionInDays` | absent | **Never expire.** Highest-priority finding. Jump to Step 1. |\n| `retentionInDays` | `1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,2192,2557,2922,3288,3653` | Valid values. Any other value is rejected at `PutRetentionPolicy` time — if observed, the snapshot is stale; re-fetch. |\n| `kmsKeyId` | absent | **SSE with CloudWatch service-managed key** (still encrypted at rest, no CMK). NO_ENCRYPTION applies (Step 2). |\n| `kmsKeyId` | ARN present | **SSE-KMS with CMK.** Verify region matches the log group region; cross-region CMK is rejected. |\n| `storedBytes` | integer | **Cumulative counter since creation** — never decreases. Use `storedBytes \u002F ageInDays` to estimate average daily ingestion. |\n| Subscription filter count | `0,1,2` | Quota is **2 per group** (raised from 1 in 2020). A third `PutSubscriptionFilter` returns `LimitExceededException`; producers are not notified and silently drop the fan-out. |\n\n**If input is unparseable** (invalid JSON, missing `logGroupName`,\ntruncated output), output:\n\n```text\nLOG_GROUP: \u003Cname-or-arn>\nVERDICT: ERROR\nREASON: Log group metadata is malformed — cannot classify. Missing field: \u003Cfield>.\nREMEDIATION: Re-fetch with `aws logs describe-log-groups --log-group-name-prefix \u003Cname> --output json` and re-audit.\n```\n\n## Process — Classification logic (first-fail-wins, in order)\n\n### Step 0: Expert knowledge — non-obvious CloudWatch Logs behaviors\n\nStep 0 expert-knowledge deep dive (no default retention, new-events-only retention changes, CMK KMS-request cost, no AWS-managed key path, 2-filter subscription quota, metric-filter no-backfill, anomaly 14-day baseline, cross-account destinations, prefix-vs-exact matching, storedBytes monotonicity, Insights per-GB billing, PutLogEvents batch limits, KMS region match, no rename, ARN :* suffix, non-retroactive AssociateKmsKey, IaC silent Never-expire, 5 TPS control-plane throttle, DLQ-less fan-out, per-detector cost) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad it before classifying edge-case inputs or pricing a CMK recommendation.\n\n### Step 1: Never-expire retention (highest priority — silent infinite cost)\n\nIf `retentionInDays` is absent, null, or 0, the log group **never\nexpires**. Verdict: **NO_RETENTION** (CRITICAL).\n\n- Storage accumulates at the Published-Log-Storage Per-GB-month rate\n  indefinitely. A 10 GB\u002Fmonth ingestion group costs ~$50\u002Fmonth in\n  storage after 1 year, ~$500\u002Fmonth after 2 years — unbounded.\n- Most compliance frameworks (SOC 2, PCI-DSS v4, ISO 27001, FedRAMP)\n  require **defined** retention. A Never-expire group is a control\n  deficiency even when \"we want to keep everything\" — the absence of\n  a documented decision is the finding.\n- Remediation is `aws logs put-retention-policy --log-group-name\n  \u003Cname> --retention-in-days \u003CN>`. The CLI does NOT prompt.\n\n**Why highest priority:** a Never-expire group with no CMK and no\nmetric filters is unambiguously NO_RETENTION (first-fail-wins). The\nabsence of retention is the loudest signal; encryption and observability\ngaps compound but cannot override it.\n\n### Step 2: SSE-KMS CMK encryption\n\nIf `kmsKeyId` is absent, null, or empty, the log group uses CloudWatch\nservice-managed encryption (SSE at rest is on, no CMK). Verdict:\n**NO_ENCRYPTION** (HIGH).\n\n- Without a CMK, you cannot audit key usage via CloudTrail\n  `kms:Decrypt` events for log access.\n- Most regulated workloads (FedRAMP, HIPAA BAA controls, SOC 2 Type\n  II with CMK mandate, PCI-DSS v4 requirement 3.5) require a\n  **customer-controlled** key for log data at rest.\n- Remediation is `aws logs associate-kms-key --log-group-name \u003Cname>\n  --kms-key-id \u003Ckey-arn>`. The key policy MUST permit\n  `logs.\u003Cregion>.amazonaws.com` to call `kms:GenerateDataKey` and\n  `kms:Decrypt` — without this, PutLogEvents\u002FGetLogEvents fail with\n  `AccessDeniedException`.\n\n**Why HIGH not CRITICAL:** SSE at rest is on by default; the gap is\ncustomer-controlled key auditability, not plaintext storage. CRITICAL is\nreserved for active data-loss or infinite-cost vectors (NO_RETENTION).\n\n### Step 3: Cost-risk retention × volume profile\n\nIf retention IS set AND a CMK IS associated, evaluate the retention ×\nvolume profile against the **COST_RISK thresholds** (table in the Quick\nReference above). The first matching row (3a → 3d) fires COST_RISK; do\nnot continue evaluating lower-priority rows once one fires.\n\n**Required inputs:** `retentionInDays`, `storedBytes`, `creationTime`\n(for the daily-ingestion estimate). If `creationTime` is missing, fall\nback to treating `storedBytes` as current storage (worst-case upper\nbound) — note the fallback in FINDINGS. If `storedBytes` is also\nmissing, the cost dimension cannot be classified and the verdict skips\nto Step 4 with a `DATA_MISSING` note.\n\n**Lambda subscription-filter cost caveat (Row 3d):** the threshold\nfires only for Lambda destinations, NOT for Kinesis Data Streams or\nFirehose — Kinesis\u002FFirehose bill by ingestion shard \u002F delivery stream,\nnot per-event invocation, so their cost profile does not multiply with\nevent volume the way Lambda does.\n\n**Why below NO_ENCRYPTION:** cost risk is bounded (retention value caps\nit); CMK absence is an unbounded auditability gap that scales with the\nvolume of regulated data flowing through the group.\n\n### Step 4: Observability config gap\n\nIf retention, encryption, and cost profile are all OK, evaluate\nobservability coverage. **CONFIG_GAP** fires when ANY of these is true:\n\n- **No metric filters** configured. Without metric filters, you cannot\n  build CloudWatch alarms on log content (error rate, latency, auth-\n  failure spikes). Baseline observability gap.\n- **No CloudWatch Logs Anomaly Detector** on the group. Anomaly\n  detectors catch unknown-unknowns (sudden pattern shifts) that fixed\n  metric filters cannot.\n- **Anomaly Detector exists but `Status: TRAINING` OR created \u003C 14\n  days ago.** A training detector produces no findings — treat as\n  CONFIG_GAP with the training caveat in REMEDIATION.\n\n**Why below COST_RISK:** a config gap does not cost money or expose\ndata — it leaves you blind to events the logs already recorded.\n\n### Step 5: All dimensions pass — OK\n\nIf retention is set to a sane value, a CMK is associated, the cost\nprofile is reasonable, and at least one metric filter OR anomaly\ndetector is present, verdict: **OK**.\n\nNote in FINDINGS which dimensions passed and any defense-in-depth\nrecommendations.\n\n## Output format (per log group)\n\n```text\nLOG_GROUP: \u003Cname-or-arn>\nVERDICT: NO_RETENTION | NO_ENCRYPTION | COST_RISK | CONFIG_GAP | OK\nREASON: \u003C1-2 sentences citing the first failing dimension and step number>\nFINDINGS:\n  - [CRITICAL] \u003Cfinding description (Step N)>\n  - [HIGH] \u003Cfinding description (Step N)>\n  - [OK] \u003Cdimension that passed>\nREMEDIATION: \u003Cspecific CLI per finding, or \"None required\" if OK>\n```\n\n### Worked example — Never-expire with no CMK\n\n```text\nLOG_GROUP: \u002Faws\u002Flambda\u002Fprod-checkout-api\nVERDICT: NO_RETENTION\nREASON: retentionInDays is absent — the log group Never expires, accumulating\nstorage cost indefinitely (Step 1). kmsKeyId is also absent (Step 2 finding)\nbut first-fail-wins terminates at Step 1.\nFINDINGS:\n  - [CRITICAL] retentionInDays absent (Never expire) — unbounded storage cost\n    and undefined retention for compliance (Step 1)\n  - [HIGH] kmsKeyId absent — CloudWatch service-managed key only; no CMK\n    auditability (Step 2, suppressed by first-fail-wins but reported)\n  - [OK] logGroupArn includes ':*' suffix — resource-level IAM policies match\nREMEDIATION:\n  1. Set retention: aws logs put-retention-policy --log-group-name\n     \u002Faws\u002Flambda\u002Fprod-checkout-api --retention-in-days 90.\n  2. Associate CMK: aws logs associate-kms-key --log-group-name\n     \u002Faws\u002Flambda\u002Fprod-checkout-api --kms-key-id\n     arn:aws:kms:us-east-1:111111111111:key\u002Fabc-123. Ensure key policy\n     permits logs.us-east-1.amazonaws.com to kms:GenerateDataKey + Decrypt.\n```\n\n### Worked example — malformed input (ERROR path)\n\nWorked example — malformed input (ERROR path) moved verbatim to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\nLoad it when describe-log-groups output is truncated or required fields are missing.\n\n## Edge-case handling\n\nEdge-case catalog (`retentionInDays: 0` literal, AWS service-created groups, OpenSearch filter quota bypass, kmsKeyId referencing a deleted key, empty metric-filter pattern, subscription filter on a Never-expire group, TRAINING anomaly detector) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad it when the audit input does not match the mainline Step 1-5 paths.\n\n## Anti-Patterns — NEVER\n\n- NEVER treat absence of `retentionInDays` as \"default 30 days\" or\n  \"default retention\". CloudWatch Logs has NO default retention —\n  absence means Never expire, the highest-severity cost finding.\n\n- NEVER classify a `retentionInDays`-absent group as NO_ENCRYPTION or\n  COST_RISK. First-fail-wins: NO_RETENTION is the verdict. Encryption\n  and cost findings may be enumerated in FINDINGS but cannot override.\n\n- NEVER assume SSE-KMS is in use because \"CloudWatch Logs is encrypted\n  at rest.\" The default is a CloudWatch service-managed key, not a\n  customer-managed CMK. The `kmsKeyId` field must be present for OK at\n  Step 2; absence is NO_ENCRYPTION.\n\n- NEVER confuse `storedBytes` with current storage. It is a cumulative\n  counter since log-group creation that never decreases. Always pair\n  with retention and age.\n\n- NEVER recommend associating a CMK without noting the KMS-request\n  cost impact. Every PutLogEvents batch triggers\n  `kms:GenerateDataKey`. For high-volume groups this can cost more\n  than the CloudWatch Logs ingestion itself.\n\n- NEVER recommend `aws logs delete-log-group` as remediation for\n  excessive storage. It destroys all historical logs irreversibly and\n  the producer will recreate the group on the next PutLogEvents. The\n  correct remediation is `PutRetentionPolicy` to a sane value;\n  deletion is reserved for genuinely decommissioned groups.\n\n- NEVER assume shortening retention immediately deletes historical\n  events. Retention changes apply only to events received AFTER the\n  PutRetentionPolicy call. If the goal is immediate data cleansing,\n  you must delete log streams or the log group — both destructive.\n\n- NEVER treat metric filters as retroactive. They process events\n  received AFTER creation only. Pair with an anomaly detector if\n  retroactive signal is needed (and accept the 2-week training delay).\n\n- NEVER overlook the 2-subscription-filter-per-group quota. A third\n  `PutSubscriptionFilter` fails with `LimitExceededException`. If you\n  need 3+ destinations, aggregate via Kinesis Data Streams or Firehose.\n\n- NEVER classify a group as OK if the only observability signal is an\n  anomaly detector in `TRAINING` status. Treat as CONFIG_GAP until it\n  has 14 days of baseline.\n\n- NEVER recommend a CMK from another region. CloudWatch Logs requires\n  an in-region key. For multi-Region keys, reference the in-region\n  replica ARN.\n\n- NEVER assume `--log-group-name-prefix` is an exact match. It is a\n  prefix — `\u002Faws\u002Flambda` matches `\u002Faws\u002FlambdaFoo`. Use\n  `--log-group-name` (no `prefix`) for exact match in CLI v2.\n\n- NEVER skip paginating `describe-log-groups`,\n  `describe-metric-filters`, `describe-subscription-filters`, or\n  `describe-anomaly-detectors`. Each caps at 50 per page. Iterating\n  only the first page silently misses the long-tail groups.\n\n- NEVER audit a subscription filter without also auditing the\n  destination policy (for cross-account destinations). The destination\n  policy IS the security boundary.\n\n- NEVER classify COST_RISK based on `retentionInDays` alone. Retention\n  × volume is the cost function; a 3653-day retention on 1 MB is\n  cheaper than 30-day retention on 1 TB. Always pair retention with\n  `storedBytes` and `creationTime`.\n\n## Pre-flight safety checks (run before any remediation CLI)\n\nPre-flight safety checks (CONFIRMATION GATE, filter backup, allowed retention values, CMK region\u002Fpolicy verification, KMS cost tolerance, DeleteLogGroup guard, destination-policy audit, additive-first) moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\nLoad it before emitting any remediation CLI.\n\n## Remediation guidance\n\n### For NO_RETENTION (Step 1)\n\n1. Set retention matching the workload's compliance window:\n   ```bash\n   aws logs put-retention-policy --log-group-name \u003Cname> \\\n     --retention-in-days 90 --profile \u003Cp>\n   ```\n2. Choose the value by intent, not default:\n   - 14-30 days for operational\u002Fdebug logs (cheapest).\n   - 90 days for application logs covering one quarter of incident review.\n   - 365 days for security\u002Fcompliance logs (SOC 2, ISO 27001 standard).\n   - 731+ days only with documented regulatory requirement (PCI-DSS\n     1-year, HIPAA 6-year, financial-services 7-year).\n3. Verify: `aws logs describe-log-groups --log-group-name-prefix \u003Cname>\n   --query 'logGroups[0].retentionInDays'`.\n4. Note the legacy-events caveat: existing events expire on their\n   original schedule, not immediately.\n\n### For NO_ENCRYPTION (Step 2)\n\n1. Identify an in-region CMK:\n   ```bash\n   aws kms describe-key --key-id \u003Ckey-id> --profile \u003Cp>\n   # Confirm Origin: AWS_KMS, KeyState: Enabled, KeyManager: CUSTOMER,\n   # and the region in the ARN matches the log group region.\n   ```\n2. Attach a key policy permitting CloudWatch Logs:\n   ```json\n   {\n     \"Sid\": \"AllowCloudWatchLogs\",\n     \"Effect\": \"Allow\",\n     \"Principal\": {\"Service\": \"logs.\u003Cregion>.amazonaws.com\"},\n     \"Action\": [\"kms:GenerateDataKey\", \"kms:Decrypt\"],\n     \"Resource\": \"*\",\n     \"Condition\": {\n       \"ArnLike\": {\"aws:SourceArn\": \"arn:aws:logs:\u003Cregion>:\u003Caccount>:log-group:*\"},\n       \"StringEquals\": {\"aws:SourceAccount\": \"\u003Caccount>\"}\n     }\n   }\n   ```\n3. Associate the CMK:\n   ```bash\n   aws logs associate-kms-key --log-group-name \u003Cname> \\\n     --kms-key-id arn:aws:kms:\u003Cregion>:\u003Caccount>:key\u002F\u003Cid> --profile \u003Cp>\n   ```\n4. Verify: `aws logs describe-log-groups --log-group-name-prefix \u003Cname>\n   --query 'logGroups[0].kmsKeyId'`.\n5. Project the KMS-request cost before committing at scale.\n\n### For COST_RISK (Step 3)\n\n1. Shorten retention to the minimum compliance window:\n   ```bash\n   aws logs put-retention-policy --log-group-name \u003Cname> \\\n     --retention-in-days 90 --profile \u003Cp>\n   ```\n2. For high-volume Lambda subscription filters: evaluate replacing\n   synchronous Lambda fan-out with Kinesis Data Streams + enhanced\n   fan-out, or move the consumer to a scheduled Logs Insights query\n   on a data subset.\n3. Archive cold logs to S3 (with S3 lifecycle to Glacier) before\n   shortening retention if regulatory retention requires long-term\n   storage but query frequency is low. Use a Firehose delivery stream\n   with a CloudWatch Logs subscription filter.\n4. Set a CloudWatch alarm on `IncomingBytes` to catch future surges:\n   ```bash\n   aws cloudwatch put-metric-alarm --alarm-name \u003Cname>-ingestion-spike \\\n     --metric-name IncomingBytes --namespace AWS\u002FLogs \\\n     --statistic Sum --period 300 --threshold \u003Cbytes> \\\n     --comparison-operator GreaterThanThreshold --evaluation-periods 1 \\\n     --dimensions Name=LogGroupName,Value=\u003Cname>\n   ```\n\n### For CONFIG_GAP (Step 4)\n\n1. Add at least one metric filter for the primary error signal:\n   ```bash\n   aws logs put-metric-filter --log-group-name \u003Cname> \\\n     --filter-name ErrorCount --filter-pattern '\"ERROR\"' \\\n     --metric-transformations metricName=ErrorCount,metricNamespace=LogMetrics,metricValue=1\n   ```\n2. Add a CloudWatch Logs Anomaly Detector:\n   ```bash\n   aws logs put-anomaly-detector --log-group-arn-list \u003Carn> \\\n     --detector-name \u003Cname>-anomaly --eval-frequency ONE_MIN --profile \u003Cp>\n   ```\n3. Wait 14 days for baseline training. Findings begin only after the\n   baseline is established.\n4. Add an alarm on the anomaly detector:\n   ```bash\n   aws cloudwatch put-metric-alarm --alarm-name \u003Cname>-anomaly-alarm \\\n     --namespace AWS\u002FLogs --metric-name \u003Cdetector-name> \\\n     --dimensions Name=LogGroup,Value=\u003Cname> \\\n     --statistic Sum --period 60 --threshold 0 \\\n     --comparison-operator GreaterThanThreshold --evaluation-periods 1\n   ```\n\n### For OK\n\n1. No remediation required for the current posture.\n2. Defense-in-depth:\n   - Add a second anomaly detector at `FIVE_MIN` for noisier groups.\n   - Add a CloudWatch alarm on `IncomingBytes` for cost-spike detection.\n   - Add a metric filter on `WARN` for early-warning signal.\n   - For multi-account deployments, centralize logs via a cross-account\n     subscription filter to a security-tooling account with a\n     destination policy scoped via `aws:SourceAccount`.\n\n## Recent AWS features (2024-2026)\n\nRecent AWS features 2024-2026 (Infrequent Access log class, account-level data protection policies, data lifecycle to S3\u002FGlacier, subscription filter improvements) moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\nLoad it when auditing log class, data protection, or lifecycle posture.\n\n## References (load on demand)\n\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Step 0 expert-knowledge deep dive, edge-case catalog, and 2024-2026 AWS features moved from SKILL.md\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight safety checks (confirmation gate, filter backups, KMS cost tolerance) moved from SKILL.md\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — malformed-input ERROR worked example moved from SKILL.md; the primary Never-expire example stays in SKILL.md\n\n## Domain\n\nAWS CloudOps \u002F Management & Governance — CloudWatch Logs cost, security,\nand observability posture.\n\n## AWS documentation\n\n- **Amazon CloudWatch Logs User Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002FWhatIsCloudWatchLogs.html\n- **CloudWatch Logs Security** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002Fsecurity.html\n- **CloudWatch Logs API Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatchLogs\u002Flatest\u002FAPIReference\u002F\n- **AWS CLI Command Reference (logs)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Flogs\u002F\n- **Log class (Standard vs Infrequent Access)** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudWatch\u002Flatest\u002Flogs\u002FCloudWatch_Logs_LogClasses.html\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":39},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"complexity":32,"entry_point":33,"when_to_use":34,"requires_llm":35,"verdict_shape":36,"invocation_schema":37,"supports_pipeline":35,"activation_triggers":38},"cloudwatch-logs, management, retention, cost, kms-encryption, metric-filters, anomaly-detection, audit","2","Jacky Chan — AWS Community Builder","aws-cloudops","Management","0.1.0","CloudWatch Logs, log group retention, Never expire, retentionInDays, SSE-KMS, customer-managed key, kmsKeyId, metric filter, subscription filter, anomaly detector, CloudWatch Logs Insights, storedBytes, PutRetentionPolicy, AssociateKmsKey, PutMetricFilter, PutSubscriptionFilter, log cost audit, infinite retention, compliance retention, observability gap","medium","false","Pre-compliance review of CloudWatch Logs log groups, Never-expire retention audits, KMS CMK encryption verification, runaway log cost investigations, metric-filter \u002F anomaly-detector coverage audits, or hardening log-group posture before production cutover.","true","NO_RETENTION | NO_ENCRYPTION | COST_RISK | CONFIG_GAP | OK","Input: either (a) describe-log-groups output (JSON or key-value summary) for one log group, optionally paired with describe-metric-filters, describe-subscription-filters, and describe-anomaly-detectors output, OR (b) a log-group name\u002FARN for live-account audit. Output: deterministic LOG_GROUP\u002FVERDICT\u002FREASON\u002F FINDINGS\u002FREMEDIATION block per log group, where VERDICT ∈ {NO_RETENTION, NO_ENCRYPTION, COST_RISK, CONFIG_GAP, OK, ERROR}.","audit this CloudWatch Logs group, is my log group retention set, Never expire log group, check CloudWatch Logs cost, is CloudWatch Logs encrypted with KMS, are metric filters configured, is anomaly detection enabled, subscription filter audit, CloudWatch Logs compliance check, log group cost risk","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline config classification. Live-account audits use aws logs describe-log-groups, describe-metric-filters, describe-subscription-filters, describe-anomaly-detectors, and aws kms describe-key (AWS CLI v2, SSO or key-based credentials).","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fcloudwatch-logs-retention-auditor",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":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill cloudwatch-logs-retention-auditor",{"tool":54,"command":55},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill cloudwatch-logs-retention-auditor",{"tool":57,"command":58},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill cloudwatch-logs-retention-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002FSKILL.md",true,[62,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",8220,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Feval\u002Ftest-cases.yaml",{"path":69,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":70,"sourceHtmlUrl":71},"evals\u002Fbaselines\u002Ffully-secured-ok.md",440,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fbaselines\u002Ffully-secured-ok.md",{"path":73,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":74,"sourceHtmlUrl":75},"evals\u002Fbaselines\u002Flong-retention-cost-risk.md",640,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fbaselines\u002Flong-retention-cost-risk.md",{"path":77,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":78,"sourceHtmlUrl":79},"evals\u002Fbaselines\u002Fmissing-anomaly-detector-config-gap.md",569,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fbaselines\u002Fmissing-anomaly-detector-config-gap.md",{"path":81,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":82,"sourceHtmlUrl":83},"evals\u002Fbaselines\u002Fno-retention-never-expire.md",866,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fbaselines\u002Fno-retention-never-expire.md",{"path":85,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":86,"sourceHtmlUrl":87},"evals\u002Fbaselines\u002Fno-retention-trumps-encryption.md",628,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fbaselines\u002Fno-retention-trumps-encryption.md",{"path":89,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":90,"sourceHtmlUrl":91},"evals\u002Fbaselines\u002Fretention-set-no-kms-cmk.md",664,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fbaselines\u002Fretention-set-no-kms-cmk.md",{"path":93,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":94,"sourceHtmlUrl":95},"evals\u002Feval_config.yaml",2110,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Feval_config.yaml",{"path":97,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":98,"sourceHtmlUrl":99},"evals\u002Fevals.json",5269,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fevals.json",{"path":101,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":102,"sourceHtmlUrl":103},"evals\u002Fprompts\u002Ffully-secured-ok.md",782,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fprompts\u002Ffully-secured-ok.md",{"path":105,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":106,"sourceHtmlUrl":107},"evals\u002Fprompts\u002Flong-retention-cost-risk.md",748,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fprompts\u002Flong-retention-cost-risk.md",{"path":109,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":110,"sourceHtmlUrl":111},"evals\u002Fprompts\u002Fmissing-anomaly-detector-config-gap.md",787,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fprompts\u002Fmissing-anomaly-detector-config-gap.md",{"path":113,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":114,"sourceHtmlUrl":115},"evals\u002Fprompts\u002Fno-retention-never-expire.md",830,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fprompts\u002Fno-retention-never-expire.md",{"path":117,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":118,"sourceHtmlUrl":119},"evals\u002Fprompts\u002Fno-retention-trumps-encryption.md",758,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fprompts\u002Fno-retention-trumps-encryption.md",{"path":121,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":122,"sourceHtmlUrl":123},"evals\u002Fprompts\u002Fretention-set-no-kms-cmk.md",759,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fevals\u002Fprompts\u002Fretention-set-no-kms-cmk.md",{"path":125,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":126,"sourceHtmlUrl":127},"examples\u002Fend-to-end.md",7471,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fexamples\u002Fend-to-end.md",{"path":129,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":130,"sourceHtmlUrl":131},"references\u002Fadvanced-patterns.md",10617,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Freferences\u002Fadvanced-patterns.md",{"path":133,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":134,"sourceHtmlUrl":135},"references\u002Fdiagnostic-commands.md",2376,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Freferences\u002Fdiagnostic-commands.md",{"path":137,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":138,"sourceHtmlUrl":139},"references\u002Fworked-examples.md",980,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Freferences\u002Fworked-examples.md",{"path":141,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":142,"sourceHtmlUrl":143},"skill.usf.yaml",4200,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudwatch-logs-retention-auditor\u002Fskill.usf.yaml",[145,152,159,166,173,180],{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"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":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"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":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"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":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"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":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"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":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"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",[],[]]