Athena Workgroup Auditor
Mindset
One-line takeaway: Athena workgroups are the only native boundary
between a caller with athena:StartQueryExecution and an unbounded,
plaintext-result scan of your data lake. Three controls decide whether
that boundary is real or decorative — EnforceWorkGroupConfiguration
(the keystone), EncryptionConfiguration (result-set confidentiality),
and BytesScannedCutoffPerQuery (cost + data-volume blast radius).
A workgroup is not a security principal and not a network — it is a
configuration template applied at query time. The operator's intent is
encoded in Configuration; the question is whether that intent is
binding or advisory:
EnforceWorkGroupConfiguration: true makes the workgroup's
ResultConfiguration (OutputLocation, EncryptionConfiguration) and
BytesScannedCutoffPerQuery authoritative — client-supplied overrides
in StartQueryExecution are silently ignored. This is the only mode
in which the workgroup acts as a real boundary.
EnforceWorkGroupConfiguration: false (historically the default
for the primary workgroup) reduces every setting below to a
suggestion — any caller can write results to a bucket in another
account, disable encryption, or scan unbounded bytes. Treat the
workgroup as decorative in this state.
A workgroup with EnforceWorkGroupConfiguration: true, SSE-KMS with a
customer-managed key, and a sane BytesScannedCutoffPerQuery is OK. Any
other combination produces a category verdict describing the worst gap.
Quick reference — verdict priority
Apply the priority in order — the first matching row is the verdict.
Where multiple findings apply, the highest-priority category wins
(NO_ENCRYPTION > NO_LIMITS > CONFIG_GAP > OK).
| Condition |
Verdict |
Rule |
EnforceWorkGroupConfiguration: true AND EncryptionConfiguration ABSENT |
NO_ENCRYPTION |
Step 3 — definitive plaintext result objects |
EnforceWorkGroupConfiguration: false AND EncryptionConfiguration ABSENT (any workgroup, incl. primary) |
NO_ENCRYPTION |
Step 3 — clients inherit no-encryption default |
EnforceWorkGroupConfiguration: true AND EncryptionConfiguration present AND BytesScannedCutoffPerQuery ABSENT |
NO_LIMITS |
Step 4 — unbounded cost + data-scan blast radius |
EnforceWorkGroupConfiguration: false AND (EncryptionConfiguration AND BytesScannedCutoffPerQuery both present) |
CONFIG_GAP |
Step 2 — controls present but advisory |
EnforceWorkGroupConfiguration: true AND no CloudTrail Athena data-event capture |
CONFIG_GAP |
Step 5 — query history falls off the 45-day API cliff |
Named-query IAM grants athena:GetNamedQuery/StartNamedQuery to Principal: "*" or cross-account |
CONFIG_GAP |
Step 6 — SQL exfiltration surface |
| All controls present, enforced, and history/IAM scoped |
OK |
Step 7 |
See the ordered steps below for edge cases (Spark workgroups, SSE-S3
acceptance, workgroup deletion mid-flight, primary-workgroup defaults).
Deep Athena internals (engine version coupling, Glue/Lake Formation
interaction, multi-region model) are in the
Deep reference section.
Pre-flight: workgroup metadata gate (run before classification)
Several workgroup attributes short-circuit the audit —
misclassifying them produces false positives.
Account-wide sweep pagination note and the three live-account pre-flight checks (athena:GetWorkGroup permission, CloudTrail Athena data-event confirmation, config snapshot before any UpdateWorkGroup): Diagnostic commands.
| Attribute |
Value |
Effect on audit |
Name |
primary |
AWS-created default workgroup. Cannot be deleted (API returns InvalidRequestException). Historically created with EnforceWorkGroupConfiguration: false. Treat as high-priority — every principal with athena:StartQueryExecution + athena:GetWorkGroup on primary can run unbounded, unencrypted queries unless the field has been explicitly flipped to true. |
Name |
any user-created |
Proceed with full audit. |
State |
DISABLED |
Workgroup rejects all StartQueryExecution calls with InvalidRequestException. Note as operational risk (consumer outage) but skip the rest of the audit — the workgroup cannot produce live findings. |
Configuration.EngineVersion.SelectedEngineVersion |
Athena engine version 3 (PySpark-compatible) |
Athena Spark / notebook workgroup. BytesScannedCutoffPerQuery does NOT apply to Spark sessions — it governs interactive SQL only. Spark compute limits are governed by session Coarse/executor sizing. Do NOT flag a Spark workgroup as NO_LIMITS based on a missing DSL; flag it as CONFIG_GAP (Spark sizing not bounded) instead. |
Configuration.EngineVersion.SelectedEngineVersion |
Athena engine version 3 (SQL) or Athena engine version 2 |
Standard SQL workgroup. Proceed with full audit. |
State |
ENABLED + workgroup has running QueryExecution states QUEUED/RUNNING |
Live workgroup — findings have current blast radius. |
Description |
non-empty |
Read but do NOT trust for classification. The description is the de-facto data-classification surface (no native tagging pre-2022); it often encodes environment (prod/dev) and data sensitivity. Use it to prioritize remediation order, not to set verdict. |
If the workgroup Configuration JSON is malformed (invalid JSON,
missing ResultConfiguration, missing WorkGroupConfiguration), output:
ERROR-verdict output block for a malformed Configuration block: Error handling.
Process — Classification logic (apply in order, aggregate worst)
Step 0: Expert knowledge — non-obvious Athena behaviors that change classification
All sixteen Step-0 expert behaviors — EnforceWorkGroupConfiguration is a binary contract, DSL counts compressed S3 bytes, DSL absent ≠ 0, EncryptionConfiguration covers OutputLocation writes only, SSE_S3 is still encryption, query history is a fixed 45-day window, primary is undeletable, named queries persist SQL in plaintext, GetQueryResults is a data-exfiltration vector, OutputLocation bucket-policy alignment, workgroup-to-KMS key-policy coupling, API quotas are account-region, Spark workgroups ignore the DSL, PublishCloudWatchMetricsEnabled is an observability note, tags do not propagate to results, deletion is a soft delete: Advanced patterns.
Step 1: Pre-flight gate — primary workgroup and engine type
Apply the Pre-flight table above. If the workgroup is primary, flag
a PRIMARY_DEFAULT note (the workgroup is undeletable and historically
defaulted to permissive settings). If the engine is AthenaSpark, route
DSL evaluation to Step 4b (Spark sizing) instead of Step 4.
Step 2: Enforcement gate — EnforceWorkGroupConfiguration
This step is the keystone. All subsequent findings depend on it.
EnforceWorkGroupConfiguration: true → the workgroup's
Configuration is binding. Proceed to Steps 3-6; findings reflect the
workgroup's actual enforced posture.
EnforceWorkGroupConfiguration: false → the workgroup's
ResultConfiguration (encryption, OutputLocation) is advisory; the DSL
is binding (see Deep reference — there is no per-query DSL parameter
in StartQueryExecution). Two sub-cases:
- ResultConfiguration or DSL ABSENT → the verdict is driven by
that absent control, NOT by enforcement-off, because the effective
posture is "no control + clients can widen ResultConfiguration
further." A workgroup with enforce=false AND no encryption is
NO_ENCRYPTION (Step 3); a workgroup with enforce=false AND no DSL
is NO_LIMITS (Step 4). Note the enforcement gap as a compounding
finding.
- ResultConfiguration AND DSL both present → the DSL is binding
(good), but
EncryptionConfiguration and OutputLocation are
advisory — any client can override them at query time. This is
CONFIG_GAP (enforcement off) — the single most common Athena
misconfiguration. The workgroup looks secure in GetWorkGroup
output but the encryption/OutputLocation dimensions are decorative.
Do NOT skip Step 2 even when all controls are present — the
enforcement flag is the difference between a security boundary and a
documentation page.
Step 3: Encryption evaluation
Evaluate Configuration.ResultConfiguration.EncryptionConfiguration:
EncryptionConfiguration ABSENT (or ResultConfiguration itself
absent) → NO_ENCRYPTION. Result-set objects are written to S3 as
plaintext. Any principal with s3:GetObject on the OutputLocation
prefix can read every query result, including SELECT * FROM sensitive_table. This is the highest-priority category because it
is direct at-rest data exposure.
- If
EnforceWorkGroupConfiguration: false, the finding is
compounded: clients can ALSO inject a different OutputLocation
(cross-account exfiltration). Note this in FINDINGS.
- If the workgroup is
primary, this is the default-historic state —
treat as NO_ENCRYPTION with elevated priority.
EncryptionOption: SSE_S3 → Encryption is present (S3-managed
key). Acceptable for most workgroups. Emit a COMPLIANCE_NOTE if the
workload is subject to a framework requiring customer-managed keys;
do NOT classify as NO_ENCRYPTION. Continue to Step 4.
EncryptionOption: SSE_KMS with KmsKey set → Customer-managed
key encryption. Verify the KMS key policy permits Athena (see Step 0
expert note). If the KmsKey ARN is an AWS-managed key (aws/s3), it
is functionally equivalent to SSE_S3 for compliance — emit a
COMPLIANCE_NOTE. Otherwise, encryption dimension is OK.
EncryptionOption: CSE_KMS → Client-side encryption (rare).
Encryption is present. Note that CSE_KMS requires client libraries
and is not transparent to Athena engine — flag as COMPLIANCE_NOTE
for compatibility.
Step 4: Data-scan limit evaluation (SQL workgroups)
Step 4a: SQL workgroups (engine is not AthenaSpark). Evaluate
Configuration.BytesScannedCutoffPerQuery:
Field ABSENT → NO_LIMITS. No per-query byte cap. A single
SELECT * can scan the entire S3 backing of the largest Glue table
in the account — common runaway queries hit double-digit TB at
triple-digit USD per execution. This is HIGH-severity because (1) it
is uncapped cost, (2) it can saturate the account-region
StartQueryExecution quota and queue every other workgroup's queries.
- If
EnforceWorkGroupConfiguration: false, the finding is
compounded: even a client-respected DSL would be advisory.
Field present and > 0 → DSL exists. Sanity-check the value:
< 1073741824 (< 1 GB) → likely too tight; legitimate analytical
queries will fail with QueryExceedsBytesScannedLimit. Emit a
CONFIG_NOTE (operational, not a verdict driver).
1073741824 - 1099511627776 (1 GB - 1 TB) → reasonable range for
most analytical SQL on Parquet.
> 1099511627776 (> 1 TB) → generous; legitimate for heavy CSV
analytical workloads but flag as a COST_NOTE.
> 9007199254740992 (> 8 PB, approaching Long.MAX_VALUE) →
effectively absent; the DSL was set to "disable" via a huge value.
Treat as NO_LIMITS (the operator has defeated the cap).
Field present and == 0 → CONFIG_GAP. Every query exceeds 0
bytes; the workgroup is non-functional. The operator has mis-set the
value; remediation is to set a real DSL or remove the field.
Step 4b: Spark workgroups (engine is AthenaSpark).
BytesScannedCutoffPerQuery does NOT apply. Skip Step 4a. Instead,
note Spark sizing as a separate dimension: if the workgroup has no
executor sizing constraints (no AdditionalArtifacts /
notebook-session sizing), flag as CONFIG_GAP ("Spark sizing not
bounded"). Otherwise OK on this dimension.
Step 5: Query history retention evaluation
Athena's GetQueryExecution / ListQueryExecutions APIs return a
fixed 45-day rolling window. There is no workgroup setting to
extend this. Long-term query history requires shipping Athena events
out of Athena via CloudTrail.
Evaluate the CloudTrail data-event coverage for the workgroup's region:
- CloudTrail trail exists with Athena data events enabled →
query history is captured beyond 45 days (trail retention governs
the horizon). OK on this dimension.
- CloudTrail trail exists but Athena data events NOT enabled
(only management events) → only
StartQueryExecution,
CreateNamedQuery, UpdateWorkGroup etc. are captured (which
include the SQL in requestParameters.QueryString for management
events — usually sufficient). Emit a HISTORY_NOTE that
GetQueryResults data events are not captured (forensics for
result-set reads are absent). Not a verdict driver by itself.
- No CloudTrail trail in the workgroup's region → CONFIG_GAP.
Query history past 45 days is gone. For regulated workloads, this is
a finding driver if no other dimension produces a higher-priority
verdict.
Step 6: Named-query IAM evaluation
For each named query in the workgroup (via
aws athena list-named-queries --work-group <name> →
aws athena get-named-query --named-query-id <id>), evaluate the IAM
grants on the workgroup ARN:
- Any identity-based or resource-based policy grants
athena:GetNamedQuery or athena:StartNamedQuery to
Principal: "*" → CONFIG_GAP. The named query's SQL is
readable by any AWS account principal (subject to their identity
policy). If the SQL contains hardcoded identifiers, customer IDs, or
sensitive predicates, it is a data leak.
- Cross-account grant of
athena:GetNamedQuery (any principal ARN
whose 12-digit account ID differs from the workgroup's account) →
CONFIG_GAP. External account can read the SQL.
- Same-account grant of
athena:GetNamedQuery to a broad role
(e.g., arn:aws:iam::ACCOUNT:role/*) → HISTORY_NOTE (broad but
in-account; not a verdict driver unless SQL contains secrets).
- Named queries scoped to specific role ARNs → OK on this dimension.
For live-account audits, enumerate named queries via the API; for
offline audits, accept a list of (NamedQueryId, NamedQuerySql, IamGrants) tuples as input.
Step 7: Aggregation — worst verdict wins
The final verdict is the highest-priority category across all
findings, where NO_ENCRYPTION > NO_LIMITS > CONFIG_GAP > OK:
verdict = max_priority(encryption_finding, dsl_finding, enforcement_finding,
history_finding, named_query_iam_finding)
If no findings (all dimensions OK), the verdict is OK.
Output format (per workgroup)
WORKGROUP: <name>
VERDICT: NO_ENCRYPTION | NO_LIMITS | CONFIG_GAP | OK
REASON: <1-2 sentences citing the worst finding and its step number>
FINDINGS:
- [NO_ENCRYPTION] <finding description (Step N)>
- [CONFIG_GAP] <finding description (Step N)>
REMEDIATION: <specific action per finding, or "None required" if OK>
Worked example — primary workgroup, all controls missing
WORKGROUP: primary
VERDICT: NO_ENCRYPTION
REASON: primary workgroup (undeletable) has EnforceWorkGroupConfiguration false
and no EncryptionConfiguration — every caller inherits plaintext result writes
and can override to widen exposure (Step 3). No DSL compounds the cost blast.
FINDINGS:
- [NO_ENCRYPTION] EncryptionConfiguration absent; result objects written to S3 as plaintext (Step 3)
- [NO_LIMITS] BytesScannedCutoffPerQuery absent; single query can scan unbounded S3 bytes (Step 4)
- [CONFIG_GAP] EnforceWorkGroupConfiguration false — all controls advisory (Step 2)
- [PRIMARY_DEFAULT] Workgroup is 'primary' — undeletable; must be locked down or IAM-quarantined (Step 1)
REMEDIATION:
1. Set EnforceWorkGroupConfiguration: true via UpdateWorkGroup (Step 2 remediation).
2. Configure ResultConfiguration.EncryptionConfiguration with SSE_KMS + a CMK ARN.
3. Set BytesScannedCutoffPerQuery to a sane value (start with 1099511627776 = 1 TB; tune down).
4. If the primary workgroup is not used, add an IAM Deny on athena:StartQueryExecution for the primary ARN.
Edge-case handling
Edge cases — partially malformed Configuration, OutputLocation absent with enforce=true, bucket-policy SSE-KMS mismatch, Spark DSL no-op, State: DISABLED, cross-account OutputLocation bucket, no named queries: Advanced patterns.
Anti-Patterns — NEVER
NEVER classify a workgroup with EncryptionOption: SSE_S3 as
NO_ENCRYPTION. SSE_S3 is encryption at rest (S3-managed key). It is
acceptable for most workloads. Confusing SSE_S3 with "no encryption"
produces false positives and erodes trust in the audit. The
NO_ENCRYPTION verdict is reserved for ABSENT EncryptionConfiguration
(or ResultConfiguration absent).
NEVER evaluate BytesScannedCutoffPerQuery without first checking
EnforceWorkGroupConfiguration. A DSL of 1 TB on a workgroup with
enforcement OFF is decorative — every client can override it. The
finding is CONFIG_GAP (enforcement off), not "DSL is set, OK on
limits."
NEVER flag a Spark workgroup as NO_LIMITS based on a missing
BytesScannedCutoffPerQuery. The DSL field does not apply to Spark
sessions — flag as CONFIG_GAP (Spark sizing not bounded) instead.
Confirm EngineVersion is SQL before applying Step 4a.
NEVER treat Athena's 45-day GetQueryExecution window as a tunable
workgroup setting. It is a fixed service-side retention. There is no
QueryHistoryRetentionInDays field. Operators asking to "extend
Athena query history" must be routed to CloudTrail data events /
CloudTrail Lake — not to a workgroup config change.
NEVER recommend deleting the primary workgroup as remediation.
DeleteWorkGroup on primary returns InvalidRequestException. The
primary workgroup is undeletable — remediation is either lock it
down (EnforceWorkGroupConfiguration: true + SSE-KMS + DSL) or
IAM-quarantine it (Deny athena:StartQueryExecution on the primary
ARN).
NEVER assume EnforceWorkGroupConfiguration: true prevents the
client from setting a different ResultConfiguration in
StartQueryExecution. It does — the override is silently ignored —
but the inverse (assuming enforcement=false is fine because "clients
follow convention") is the single most common Athena incident
pattern. Treat enforcement=false as a finding.
NEVER conflate EncryptionConfiguration on result objects with
source-data encryption. The workgroup's EncryptionConfiguration
covers ONLY the OutputLocation writes. Source S3 bucket encryption,
Glue Data Catalog encryption, and KMS key policies on the source are
separate audits. State the scope precisely in FINDINGS.
NEVER overlook named-query SQL as a leak surface. Named queries are
plaintext in GetNamedQuery responses; they are NOT encrypted by
the workgroup's EncryptionConfiguration. A named query containing
hardcoded customer IDs or sensitive predicates is a leak to any
principal with athena:GetNamedQuery on the workgroup ARN.
NEVER treat BytesScannedCutoffPerQuery: 0 as "no limit." Zero
blocks every query (every scan exceeds 0 bytes). The workgroup is
non-functional — CONFIG_GAP. The "no limit" state is field ABSENT.
NEVER treat a BytesScannedCutoffPerQuery value near Long.MAX_VALUE
(e.g., 9223372036854775807) as "DSL is set." Values that large are
the operator's way of defeating the cap — effectively NO_LIMITS.
NEVER assume OutputLocation bucket policy aligns with the workgroup's
EncryptionConfiguration. A bucket enforcing SSE-KMS will reject
workgroup writes configured for SSE_S3 or plaintext — manifesting as
silent query failures. Always cross-reference the bucket policy in
the operational remediation guidance.
NEVER scope athena:GetQueryResults to Resource: "*" in IAM. It is
a data-exfiltration vector equivalent to s3:GetObject on the result
prefix — a principal with athena:StartQueryExecution +
athena:GetQueryResults on a workgroup can read entire sensitive
tables via SELECT *. Scope to specific workgroup ARNs.
NEVER recommend CSE_KMS as a remediation. It requires client-side
libraries and breaks Athena engine integration for most workloads.
Prefer SSE_KMS with a customer-managed key — same compliance
posture, transparent to the engine.
NEVER classify a State: DISABLED workgroup as NO_ENCRYPTION or
NO_LIMITS based on absent controls. A disabled workgroup cannot run
queries — the findings are inactive. Emit VERDICT: OK with a
STATE_NOTE so the operator knows to re-audit if re-enabled.
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation
(
UpdateWorkGroup, DeleteWorkGroup, CreateNamedQuery,
PutResourcePolicy), the auditor MUST emit:
CONFIRM: About to <action> on workgroup <name> in account <account>, region <region>. This affects <consequence>. Proceed? (yes/no)
Do NOT execute the CLI command until the operator confirms. This gate
prevents automated pipelines from silently modifying Athena workgroups
mid-batch.
UpdateWorkGroup is unversioned. There is no rollback — the prior
Configuration is irretrievable unless the operator snapshotted it.
BEFORE any UpdateWorkGroup, capture:
aws athena get-work-group --work-group <name> --output json > /tmp/<name>-backup-$(date +%s).json
- Flipping
EnforceWorkGroupConfiguration from false to true is a
breaking change for clients relying on per-query overrides. Any
client passing a custom ResultConfiguration in StartQueryExecution
will have that override silently ignored post-flip. Surface this
before the operator approves — query pipelines may fail with
unexpected OutputLocation or encryption behavior.
- Setting
BytesScannedCutoffPerQuery too low breaks legitimate
analytical queries. Start with a generous value (1 TB =
1099511627776 bytes) and tune down based on observed query
statistics (aws athena get-query-execution Statistics).
- Verify the KMS key exists and is enabled before pointing SSE_KMS at
it.
aws kms describe-key --key-id <id> — fail closed (skip
remediation) if the key is Disabled or PendingDeletion.
- For SSE-KMS, verify the key policy permits Athena. The key policy
must allow
kms:GenerateDataKey and kms:Decrypt to
athena.<region>.amazonaws.com (and to the caller's role for
result-read). Without this, queries will fail at result write.
- Prefer additive changes over destructive ones. Add a
BytesScannedCutoffPerQuery (new field) BEFORE removing an
OutputLocation override; flip EnforceWorkGroupConfiguration to true
BEFORE deleting the primary workgroup's IAM grants.
- For
primary workgroup remediation, prefer IAM-quarantine
(Deny athena:StartQueryExecution on the primary ARN) over
configuration change — primary is shared infrastructure and other
teams may have undocumented dependencies.
Remediation guidance
Ordering principle: always prefer additive changes (add a DSL,
add an EncryptionConfiguration, add an IAM Deny) over destructive
changes (remove a statement, delete a named query). Additive changes
are reversible and do not risk breaking existing query pipelines.
Full per-verdict remediation playbooks with CLI (NO_ENCRYPTION, NO_LIMITS, CONFIG_GAP enforcement-off / CloudTrail data events / named-query IAM, OK): Advanced patterns.
Deep reference: Athena workgroup internals
Workgroup internals — evaluation order at query time (the DSL binds even when enforcement is off), workgroup vs. IAM evaluation order, primary lifecycle, tagging, AthenaSpark: Advanced patterns.
Recent AWS features (2024-2026)
Recent AWS features (capacity reservations, Spark/notebook workgroups, parameterized queries, cross-account workgroup queries): Advanced patterns.
References (load on demand)
- Advanced patterns — Step-0 expert behaviours, edge-case catalog, per-verdict remediation playbooks, workgroup-internals deep reference, recent AWS features
- Diagnostic commands — account-wide sweep pagination and live-account pre-flight checks
- Error handling — ERROR-verdict block for malformed workgroup Configuration JSON
Domain
AWS CloudOps / Athena Analytics Security, Cost Control & Compliance.
AWS documentation
1---2name: athena-workgroup-auditor3description: Audits Amazon Athena workgroups for query-result encryption gaps (S3 + KMS), missing data-scan limits (BytesScannedCutoffPerQuery), workgroup enforcement posture (EnforceWorkGroupConfiguration — the keystone control that makes every other setting binding vs advisory), query-history retention beyond Athena's fixed 45-day API window, and named-query IAM exposure. Emits a deterministic category verdict (NO_ENCRYPTION | NO_LIMITS | CONFIG_GAP | OK) per workgroup with enumerated findings and CLI remediation. Use when reviewing Athena workgroups, checking result-encryption posture, validating per-query cost bounds, confirming client-override enforcement, auditing Athena query-history retention, or scoping named-query IAM before granting cross-team access.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline workgroup-config classification. Live-account audits use aws athena get-work-group, list-work-groups, get-named-query, and list-named-queries (AWS CLI v2, SSO or key-based credentials), plus aws cloudtrail describe-trail and get-event-selectors for the data-event coverage dimension.6metadata:7 source: https://skillmd.com/skills/jhkchan/athena-workgroup-auditor8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Analytics15 verdict_shape: NO_ENCRYPTION | NO_LIMITS | CONFIG_GAP | OK16 when_to_use: Reviewing an Athena workgroup before production rollout, checking that query-result encryption (SSE-KMS with a CMK) is configured and enforced, validating that BytesScannedCutoffPerQuery caps runaway cost, confirming EnforceWorkGroupConfiguration is true (the keystone control), auditing long-term query history beyond Athena's fixed 45-day API window, or scoping named-query IAM to prevent SQL exfiltration via GetNamedQuery.17 activation_triggers: audit this Athena workgroup, is my Athena workgroup enforced, check Athena query result encryption, is BytesScannedCutoffPerQuery set, Athena data scan limit, primary workgroup defaults, Athena query history retention, named query IAM exposure, EnforceWorkGroupConfiguration false, Athena cost blast radius18 invocation_schema: 'Input: either (a) an Athena workgroup Configuration block (the JSON returned by aws athena get-work-group), optionally paired with the workgroup Name/State/Description and any named-query + IAM context, OR (b) a workgroup name for live-account audit. Output: deterministic WORKGROUP/VERDICT/REASON/FINDINGS/REMEDIATION block per workgroup, where VERDICT ∈ {NO_ENCRYPTION, NO_LIMITS, CONFIG_GAP, OK, ERROR}.'19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 keywords: Athena, workgroup, EnforceWorkGroupConfiguration, BytesScannedCutoffPerQuery, data scan limit, query result encryption, SSE-KMS, SSE-S3, OutputLocation, named query IAM, query history retention, CloudTrail data events, primary workgroup, AthenaSpark, cost blast radius, data exfiltration, Athena audit, workgroup remediation22 tags: athena, analytics, security, cost-control, workgroup, encryption, dsl, audit23---2425# Athena Workgroup Auditor2627## Mindset2829**One-line takeaway:** Athena workgroups are the only native boundary30between a caller with `athena:StartQueryExecution` and an unbounded,31plaintext-result scan of your data lake. Three controls decide whether32that boundary is real or decorative — `EnforceWorkGroupConfiguration`33(the keystone), `EncryptionConfiguration` (result-set confidentiality),34and `BytesScannedCutoffPerQuery` (cost + data-volume blast radius).3536A workgroup is not a security principal and not a network — it is a37configuration template applied at query time. The operator's intent is38encoded in `Configuration`; the question is whether that intent is39binding or advisory:4041- **`EnforceWorkGroupConfiguration: true`** makes the workgroup's42 `ResultConfiguration` (OutputLocation, EncryptionConfiguration) and43 `BytesScannedCutoffPerQuery` authoritative — client-supplied overrides44 in `StartQueryExecution` are silently ignored. This is the only mode45 in which the workgroup acts as a real boundary.46- **`EnforceWorkGroupConfiguration: false`** (historically the default47 for the `primary` workgroup) reduces every setting below to a48 suggestion — any caller can write results to a bucket in another49 account, disable encryption, or scan unbounded bytes. Treat the50 workgroup as decorative in this state.5152A workgroup with `EnforceWorkGroupConfiguration: true`, SSE-KMS with a53customer-managed key, and a sane `BytesScannedCutoffPerQuery` is OK. Any54other combination produces a category verdict describing the worst gap.5556## Quick reference — verdict priority5758Apply the priority in order — the first matching row is the verdict.59Where multiple findings apply, the **highest-priority category** wins60(NO_ENCRYPTION > NO_LIMITS > CONFIG_GAP > OK).6162| Condition | Verdict | Rule |63|---|---|---|64| `EnforceWorkGroupConfiguration: true` AND `EncryptionConfiguration` ABSENT | **NO_ENCRYPTION** | Step 3 — definitive plaintext result objects |65| `EnforceWorkGroupConfiguration: false` AND `EncryptionConfiguration` ABSENT (any workgroup, incl. `primary`) | **NO_ENCRYPTION** | Step 3 — clients inherit no-encryption default |66| `EnforceWorkGroupConfiguration: true` AND `EncryptionConfiguration` present AND `BytesScannedCutoffPerQuery` ABSENT | **NO_LIMITS** | Step 4 — unbounded cost + data-scan blast radius |67| `EnforceWorkGroupConfiguration: false` AND (`EncryptionConfiguration` AND `BytesScannedCutoffPerQuery` both present) | **CONFIG_GAP** | Step 2 — controls present but advisory |68| `EnforceWorkGroupConfiguration: true` AND no CloudTrail Athena data-event capture | **CONFIG_GAP** | Step 5 — query history falls off the 45-day API cliff |69| Named-query IAM grants `athena:GetNamedQuery`/`StartNamedQuery` to `Principal: "*"` or cross-account | **CONFIG_GAP** | Step 6 — SQL exfiltration surface |70| All controls present, enforced, and history/IAM scoped | **OK** | Step 7 |7172See the ordered steps below for edge cases (Spark workgroups, SSE-S373acceptance, workgroup deletion mid-flight, primary-workgroup defaults).74Deep Athena internals (engine version coupling, Glue/Lake Formation75interaction, multi-region model) are in the76[Deep reference](#deep-reference-athena-workgroup-internals) section.7778## Pre-flight: workgroup metadata gate (run before classification)7980Several workgroup attributes **short-circuit** the audit —81misclassifying them produces false positives.8283Account-wide sweep pagination note and the three live-account pre-flight checks (`athena:GetWorkGroup` permission, CloudTrail Athena data-event confirmation, config snapshot before any `UpdateWorkGroup`): [Diagnostic commands](references/diagnostic-commands.md).8485| Attribute | Value | Effect on audit |86|---|---|---|87| `Name` | `primary` | **AWS-created default workgroup.** Cannot be deleted (API returns `InvalidRequestException`). Historically created with `EnforceWorkGroupConfiguration: false`. Treat as high-priority — every principal with `athena:StartQueryExecution` + `athena:GetWorkGroup` on `primary` can run unbounded, unencrypted queries unless the field has been explicitly flipped to `true`. |88| `Name` | any user-created | Proceed with full audit. |89| `State` | `DISABLED` | Workgroup rejects all `StartQueryExecution` calls with `InvalidRequestException`. Note as operational risk (consumer outage) but skip the rest of the audit — the workgroup cannot produce live findings. |90| `Configuration.EngineVersion.SelectedEngineVersion` | `Athena engine version 3` (PySpark-compatible) | **Athena Spark / notebook workgroup.** `BytesScannedCutoffPerQuery` does NOT apply to Spark sessions — it governs interactive SQL only. Spark compute limits are governed by session Coarse/executor sizing. Do NOT flag a Spark workgroup as NO_LIMITS based on a missing DSL; flag it as CONFIG_GAP (Spark sizing not bounded) instead. |91| `Configuration.EngineVersion.SelectedEngineVersion` | `Athena engine version 3` (SQL) or `Athena engine version 2` | Standard SQL workgroup. Proceed with full audit. |92| `State` | `ENABLED` + workgroup has running `QueryExecution` states `QUEUED`/`RUNNING` | Live workgroup — findings have current blast radius. |93| `Description` | non-empty | Read but do NOT trust for classification. The description is the de-facto data-classification surface (no native tagging pre-2022); it often encodes environment (prod/dev) and data sensitivity. Use it to prioritize remediation order, not to set verdict. |9495**If the workgroup Configuration JSON is malformed** (invalid JSON,96missing `ResultConfiguration`, missing `WorkGroupConfiguration`), output:97ERROR-verdict output block for a malformed Configuration block: [Error handling](references/error-handling.md).9899## Process — Classification logic (apply in order, aggregate worst)100101### Step 0: Expert knowledge — non-obvious Athena behaviors that change classification102103All sixteen Step-0 expert behaviors — `EnforceWorkGroupConfiguration` is a binary contract, DSL counts compressed S3 bytes, DSL absent ≠ 0, `EncryptionConfiguration` covers OutputLocation writes only, SSE_S3 is still encryption, query history is a fixed 45-day window, `primary` is undeletable, named queries persist SQL in plaintext, `GetQueryResults` is a data-exfiltration vector, OutputLocation bucket-policy alignment, workgroup-to-KMS key-policy coupling, API quotas are account-region, Spark workgroups ignore the DSL, `PublishCloudWatchMetricsEnabled` is an observability note, tags do not propagate to results, deletion is a soft delete: [Advanced patterns](references/advanced-patterns.md).104105### Step 1: Pre-flight gate — primary workgroup and engine type106107Apply the Pre-flight table above. If the workgroup is `primary`, flag108a PRIMARY_DEFAULT note (the workgroup is undeletable and historically109defaulted to permissive settings). If the engine is AthenaSpark, route110DSL evaluation to Step 4b (Spark sizing) instead of Step 4.111112### Step 2: Enforcement gate — `EnforceWorkGroupConfiguration`113114This step is the keystone. All subsequent findings depend on it.115116- **`EnforceWorkGroupConfiguration: true`** → the workgroup's117 Configuration is binding. Proceed to Steps 3-6; findings reflect the118 workgroup's actual enforced posture.119- **`EnforceWorkGroupConfiguration: false`** → the workgroup's120 ResultConfiguration (encryption, OutputLocation) is advisory; the DSL121 is binding (see Deep reference — there is no per-query DSL parameter122 in `StartQueryExecution`). Two sub-cases:123 - **ResultConfiguration or DSL ABSENT** → the verdict is driven by124 that absent control, NOT by enforcement-off, because the effective125 posture is "no control + clients can widen ResultConfiguration126 further." A workgroup with enforce=false AND no encryption is127 NO_ENCRYPTION (Step 3); a workgroup with enforce=false AND no DSL128 is NO_LIMITS (Step 4). Note the enforcement gap as a compounding129 finding.130 - **ResultConfiguration AND DSL both present** → the DSL is binding131 (good), but `EncryptionConfiguration` and `OutputLocation` are132 advisory — any client can override them at query time. This is133 **CONFIG_GAP (enforcement off)** — the single most common Athena134 misconfiguration. The workgroup looks secure in `GetWorkGroup`135 output but the encryption/OutputLocation dimensions are decorative.136137Do NOT skip Step 2 even when all controls are present — the138enforcement flag is the difference between a security boundary and a139documentation page.140141### Step 3: Encryption evaluation142143Evaluate `Configuration.ResultConfiguration.EncryptionConfiguration`:144145- **`EncryptionConfiguration` ABSENT** (or `ResultConfiguration` itself146 absent) → **NO_ENCRYPTION**. Result-set objects are written to S3 as147 plaintext. Any principal with `s3:GetObject` on the OutputLocation148 prefix can read every query result, including `SELECT * FROM149 sensitive_table`. This is the highest-priority category because it150 is direct at-rest data exposure.151 - If `EnforceWorkGroupConfiguration: false`, the finding is152 compounded: clients can ALSO inject a different OutputLocation153 (cross-account exfiltration). Note this in FINDINGS.154 - If the workgroup is `primary`, this is the default-historic state —155 treat as NO_ENCRYPTION with elevated priority.156157- **`EncryptionOption: SSE_S3`** → Encryption is present (S3-managed158 key). Acceptable for most workgroups. Emit a COMPLIANCE_NOTE if the159 workload is subject to a framework requiring customer-managed keys;160 do NOT classify as NO_ENCRYPTION. Continue to Step 4.161162- **`EncryptionOption: SSE_KMS` with `KmsKey` set** → Customer-managed163 key encryption. Verify the KMS key policy permits Athena (see Step 0164 expert note). If the KmsKey ARN is an AWS-managed key (`aws/s3`), it165 is functionally equivalent to SSE_S3 for compliance — emit a166 COMPLIANCE_NOTE. Otherwise, encryption dimension is OK.167168- **`EncryptionOption: CSE_KMS`** → Client-side encryption (rare).169 Encryption is present. Note that CSE_KMS requires client libraries170 and is not transparent to Athena engine — flag as COMPLIANCE_NOTE171 for compatibility.172173### Step 4: Data-scan limit evaluation (SQL workgroups)174175**Step 4a: SQL workgroups (engine is not AthenaSpark).** Evaluate176`Configuration.BytesScannedCutoffPerQuery`:177178- **Field ABSENT** → **NO_LIMITS**. No per-query byte cap. A single179 `SELECT *` can scan the entire S3 backing of the largest Glue table180 in the account — common runaway queries hit double-digit TB at181 triple-digit USD per execution. This is HIGH-severity because (1) it182 is uncapped cost, (2) it can saturate the account-region183 StartQueryExecution quota and queue every other workgroup's queries.184 - If `EnforceWorkGroupConfiguration: false`, the finding is185 compounded: even a client-respected DSL would be advisory.186187- **Field present and > 0** → DSL exists. Sanity-check the value:188 - `< 1073741824` (< 1 GB) → likely too tight; legitimate analytical189 queries will fail with `QueryExceedsBytesScannedLimit`. Emit a190 CONFIG_NOTE (operational, not a verdict driver).191 - `1073741824 - 1099511627776` (1 GB - 1 TB) → reasonable range for192 most analytical SQL on Parquet.193 - `> 1099511627776` (> 1 TB) → generous; legitimate for heavy CSV194 analytical workloads but flag as a COST_NOTE.195 - `> 9007199254740992` (> 8 PB, approaching Long.MAX_VALUE) →196 effectively absent; the DSL was set to "disable" via a huge value.197 Treat as NO_LIMITS (the operator has defeated the cap).198199- **Field present and `== 0`** → CONFIG_GAP. Every query exceeds 0200 bytes; the workgroup is non-functional. The operator has mis-set the201 value; remediation is to set a real DSL or remove the field.202203**Step 4b: Spark workgroups (engine is AthenaSpark).**204`BytesScannedCutoffPerQuery` does NOT apply. Skip Step 4a. Instead,205note Spark sizing as a separate dimension: if the workgroup has no206executor sizing constraints (no `AdditionalArtifacts` /207notebook-session sizing), flag as CONFIG_GAP ("Spark sizing not208bounded"). Otherwise OK on this dimension.209210### Step 5: Query history retention evaluation211212Athena's `GetQueryExecution` / `ListQueryExecutions` APIs return a213fixed **45-day rolling window**. There is no workgroup setting to214extend this. Long-term query history requires shipping Athena events215out of Athena via CloudTrail.216217Evaluate the CloudTrail data-event coverage for the workgroup's region:218219- **CloudTrail trail exists with Athena data events enabled** →220 query history is captured beyond 45 days (trail retention governs221 the horizon). OK on this dimension.222- **CloudTrail trail exists but Athena data events NOT enabled**223 (only management events) → only `StartQueryExecution`,224 `CreateNamedQuery`, `UpdateWorkGroup` etc. are captured (which225 include the SQL in `requestParameters.QueryString` for management226 events — usually sufficient). Emit a HISTORY_NOTE that227 `GetQueryResults` data events are not captured (forensics for228 result-set reads are absent). Not a verdict driver by itself.229- **No CloudTrail trail in the workgroup's region** → **CONFIG_GAP**.230 Query history past 45 days is gone. For regulated workloads, this is231 a finding driver if no other dimension produces a higher-priority232 verdict.233234### Step 6: Named-query IAM evaluation235236For each named query in the workgroup (via237`aws athena list-named-queries --work-group <name>` →238`aws athena get-named-query --named-query-id <id>`), evaluate the IAM239grants on the workgroup ARN:240241- **Any identity-based or resource-based policy grants242 `athena:GetNamedQuery` or `athena:StartNamedQuery` to243 `Principal: "*"`** → **CONFIG_GAP**. The named query's SQL is244 readable by any AWS account principal (subject to their identity245 policy). If the SQL contains hardcoded identifiers, customer IDs, or246 sensitive predicates, it is a data leak.247- **Cross-account grant of `athena:GetNamedQuery`** (any principal ARN248 whose 12-digit account ID differs from the workgroup's account) →249 **CONFIG_GAP**. External account can read the SQL.250- **Same-account grant of `athena:GetNamedQuery` to a broad role**251 (e.g., `arn:aws:iam::ACCOUNT:role/*`) → HISTORY_NOTE (broad but252 in-account; not a verdict driver unless SQL contains secrets).253- **Named queries scoped to specific role ARNs** → OK on this dimension.254255For live-account audits, enumerate named queries via the API; for256offline audits, accept a list of `(NamedQueryId, NamedQuerySql,257IamGrants)` tuples as input.258259### Step 7: Aggregation — worst verdict wins260261The final verdict is the **highest-priority category** across all262findings, where NO_ENCRYPTION > NO_LIMITS > CONFIG_GAP > OK:263264```text265verdict = max_priority(encryption_finding, dsl_finding, enforcement_finding,266 history_finding, named_query_iam_finding)267```268269If no findings (all dimensions OK), the verdict is **OK**.270271## Output format (per workgroup)272273```text274WORKGROUP: <name>275VERDICT: NO_ENCRYPTION | NO_LIMITS | CONFIG_GAP | OK276REASON: <1-2 sentences citing the worst finding and its step number>277FINDINGS:278 - [NO_ENCRYPTION] <finding description (Step N)>279 - [CONFIG_GAP] <finding description (Step N)>280REMEDIATION: <specific action per finding, or "None required" if OK>281```282283### Worked example — primary workgroup, all controls missing284285```text286WORKGROUP: primary287VERDICT: NO_ENCRYPTION288REASON: primary workgroup (undeletable) has EnforceWorkGroupConfiguration false289and no EncryptionConfiguration — every caller inherits plaintext result writes290and can override to widen exposure (Step 3). No DSL compounds the cost blast.291FINDINGS:292 - [NO_ENCRYPTION] EncryptionConfiguration absent; result objects written to S3 as plaintext (Step 3)293 - [NO_LIMITS] BytesScannedCutoffPerQuery absent; single query can scan unbounded S3 bytes (Step 4)294 - [CONFIG_GAP] EnforceWorkGroupConfiguration false — all controls advisory (Step 2)295 - [PRIMARY_DEFAULT] Workgroup is 'primary' — undeletable; must be locked down or IAM-quarantined (Step 1)296REMEDIATION:297 1. Set EnforceWorkGroupConfiguration: true via UpdateWorkGroup (Step 2 remediation).298 2. Configure ResultConfiguration.EncryptionConfiguration with SSE_KMS + a CMK ARN.299 3. Set BytesScannedCutoffPerQuery to a sane value (start with 1099511627776 = 1 TB; tune down).300 4. If the primary workgroup is not used, add an IAM Deny on athena:StartQueryExecution for the primary ARN.301```302303## Edge-case handling304305Edge cases — partially malformed Configuration, OutputLocation absent with enforce=true, bucket-policy SSE-KMS mismatch, Spark DSL no-op, `State: DISABLED`, cross-account OutputLocation bucket, no named queries: [Advanced patterns](references/advanced-patterns.md).306307## Anti-Patterns — NEVER308309- NEVER classify a workgroup with `EncryptionOption: SSE_S3` as310 NO_ENCRYPTION. SSE_S3 is encryption at rest (S3-managed key). It is311 acceptable for most workloads. Confusing SSE_S3 with "no encryption"312 produces false positives and erodes trust in the audit. The313 NO_ENCRYPTION verdict is reserved for ABSENT EncryptionConfiguration314 (or `ResultConfiguration` absent).315316- NEVER evaluate `BytesScannedCutoffPerQuery` without first checking317 `EnforceWorkGroupConfiguration`. A DSL of 1 TB on a workgroup with318 enforcement OFF is decorative — every client can override it. The319 finding is CONFIG_GAP (enforcement off), not "DSL is set, OK on320 limits."321322- NEVER flag a Spark workgroup as NO_LIMITS based on a missing323 BytesScannedCutoffPerQuery. The DSL field does not apply to Spark324 sessions — flag as CONFIG_GAP (Spark sizing not bounded) instead.325 Confirm `EngineVersion` is SQL before applying Step 4a.326327- NEVER treat Athena's 45-day `GetQueryExecution` window as a tunable328 workgroup setting. It is a fixed service-side retention. There is no329 `QueryHistoryRetentionInDays` field. Operators asking to "extend330 Athena query history" must be routed to CloudTrail data events /331 CloudTrail Lake — not to a workgroup config change.332333- NEVER recommend deleting the `primary` workgroup as remediation.334 `DeleteWorkGroup` on `primary` returns `InvalidRequestException`. The335 primary workgroup is undeletable — remediation is either lock it336 down (`EnforceWorkGroupConfiguration: true` + SSE-KMS + DSL) or337 IAM-quarantine it (Deny `athena:StartQueryExecution` on the primary338 ARN).339340- NEVER assume `EnforceWorkGroupConfiguration: true` prevents the341 client from setting a different `ResultConfiguration` in342 `StartQueryExecution`. It does — the override is silently ignored —343 but the inverse (assuming enforcement=false is fine because "clients344 follow convention") is the single most common Athena incident345 pattern. Treat enforcement=false as a finding.346347- NEVER conflate `EncryptionConfiguration` on result objects with348 source-data encryption. The workgroup's EncryptionConfiguration349 covers ONLY the OutputLocation writes. Source S3 bucket encryption,350 Glue Data Catalog encryption, and KMS key policies on the source are351 separate audits. State the scope precisely in FINDINGS.352353- NEVER overlook named-query SQL as a leak surface. Named queries are354 plaintext in `GetNamedQuery` responses; they are NOT encrypted by355 the workgroup's EncryptionConfiguration. A named query containing356 hardcoded customer IDs or sensitive predicates is a leak to any357 principal with `athena:GetNamedQuery` on the workgroup ARN.358359- NEVER treat `BytesScannedCutoffPerQuery: 0` as "no limit." Zero360 blocks every query (every scan exceeds 0 bytes). The workgroup is361 non-functional — CONFIG_GAP. The "no limit" state is field ABSENT.362363- NEVER treat a `BytesScannedCutoffPerQuery` value near Long.MAX_VALUE364 (e.g., 9223372036854775807) as "DSL is set." Values that large are365 the operator's way of defeating the cap — effectively NO_LIMITS.366367- NEVER assume OutputLocation bucket policy aligns with the workgroup's368 EncryptionConfiguration. A bucket enforcing SSE-KMS will reject369 workgroup writes configured for SSE_S3 or plaintext — manifesting as370 silent query failures. Always cross-reference the bucket policy in371 the operational remediation guidance.372373- NEVER scope `athena:GetQueryResults` to `Resource: "*"` in IAM. It is374 a data-exfiltration vector equivalent to `s3:GetObject` on the result375 prefix — a principal with `athena:StartQueryExecution` +376 `athena:GetQueryResults` on a workgroup can read entire sensitive377 tables via `SELECT *`. Scope to specific workgroup ARNs.378379- NEVER recommend `CSE_KMS` as a remediation. It requires client-side380 libraries and breaks Athena engine integration for most workloads.381 Prefer `SSE_KMS` with a customer-managed key — same compliance382 posture, transparent to the engine.383384- NEVER classify a `State: DISABLED` workgroup as NO_ENCRYPTION or385 NO_LIMITS based on absent controls. A disabled workgroup cannot run386 queries — the findings are inactive. Emit VERDICT: OK with a387 STATE_NOTE so the operator knows to re-audit if re-enabled.388389## Pre-flight safety checks (run before any remediation CLI)390391- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation392 (`UpdateWorkGroup`, `DeleteWorkGroup`, `CreateNamedQuery`,393 `PutResourcePolicy`), the auditor MUST emit:394 `CONFIRM: About to <action> on workgroup <name> in account <account>,395 region <region>. This affects <consequence>. Proceed? (yes/no)`396 Do NOT execute the CLI command until the operator confirms. This gate397 prevents automated pipelines from silently modifying Athena workgroups398 mid-batch.399- **`UpdateWorkGroup` is unversioned.** There is no rollback — the prior400 Configuration is irretrievable unless the operator snapshotted it.401 BEFORE any UpdateWorkGroup, capture:402 `aws athena get-work-group --work-group <name> --output json >403 /tmp/<name>-backup-$(date +%s).json`404- **Flipping `EnforceWorkGroupConfiguration` from false to true is a405 breaking change for clients relying on per-query overrides.** Any406 client passing a custom `ResultConfiguration` in `StartQueryExecution`407 will have that override silently ignored post-flip. Surface this408 before the operator approves — query pipelines may fail with409 unexpected OutputLocation or encryption behavior.410- **Setting `BytesScannedCutoffPerQuery` too low breaks legitimate411 analytical queries.** Start with a generous value (1 TB =412 1099511627776 bytes) and tune down based on observed query413 statistics (`aws athena get-query-execution` Statistics).414- **Verify the KMS key exists and is enabled before pointing SSE_KMS at415 it.** `aws kms describe-key --key-id <id>` — fail closed (skip416 remediation) if the key is Disabled or PendingDeletion.417- **For SSE-KMS, verify the key policy permits Athena.** The key policy418 must allow `kms:GenerateDataKey` and `kms:Decrypt` to419 `athena.<region>.amazonaws.com` (and to the caller's role for420 result-read). Without this, queries will fail at result write.421- **Prefer additive changes over destructive ones.** Add a422 `BytesScannedCutoffPerQuery` (new field) BEFORE removing an423 OutputLocation override; flip `EnforceWorkGroupConfiguration` to true424 BEFORE deleting the `primary` workgroup's IAM grants.425- **For `primary` workgroup remediation**, prefer IAM-quarantine426 (`Deny athena:StartQueryExecution` on the primary ARN) over427 configuration change — primary is shared infrastructure and other428 teams may have undocumented dependencies.429430## Remediation guidance431432**Ordering principle:** always prefer additive changes (add a DSL,433add an EncryptionConfiguration, add an IAM Deny) over destructive434changes (remove a statement, delete a named query). Additive changes435are reversible and do not risk breaking existing query pipelines.436437Full per-verdict remediation playbooks with CLI (NO_ENCRYPTION, NO_LIMITS, CONFIG_GAP enforcement-off / CloudTrail data events / named-query IAM, OK): [Advanced patterns](references/advanced-patterns.md).438439## Deep reference: Athena workgroup internals440441Workgroup internals — evaluation order at query time (the DSL binds even when enforcement is off), workgroup vs. IAM evaluation order, `primary` lifecycle, tagging, AthenaSpark: [Advanced patterns](references/advanced-patterns.md).442443## Recent AWS features (2024-2026)444445Recent AWS features (capacity reservations, Spark/notebook workgroups, parameterized queries, cross-account workgroup queries): [Advanced patterns](references/advanced-patterns.md).446447## References (load on demand)448449- [Advanced patterns](references/advanced-patterns.md) — Step-0 expert behaviours, edge-case catalog, per-verdict remediation playbooks, workgroup-internals deep reference, recent AWS features450- [Diagnostic commands](references/diagnostic-commands.md) — account-wide sweep pagination and live-account pre-flight checks451- [Error handling](references/error-handling.md) — ERROR-verdict block for malformed workgroup Configuration JSON452453## Domain454455AWS CloudOps / Athena Analytics Security, Cost Control & Compliance.456457## AWS documentation458459- **Amazon Athena User Guide** — https://docs.aws.amazon.com/athena/latest/ug/what-is.html460- **Athena security** — https://docs.aws.amazon.com/athena/latest/ug/security.html461- **Athena API Reference** — https://docs.aws.amazon.com/athena/latest/APIReference/462- **Athena CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/athena/463- **Athena workgroups** — https://docs.aws.amazon.com/athena/latest/ug/workgroups.html