Skip to content

WorkGroup

Source: src/AWS/Athena/WorkGroup.ts

An Amazon Athena workgroup — an isolation boundary for queries that pins the S3 result-output location, result encryption, a bytes-scanned cutoff, and whether that configuration is enforced over per-query client settings.

Workgroup with an enforced result location

const results = yield* AWS.S3.Bucket("AthenaResults", {});
const wg = yield* AWS.Athena.WorkGroup("Analytics", {
outputLocation: results.bucketName.pipe(
Output.map((b) => `s3://${b}/results/`),
),
enforceWorkGroupConfiguration: true,
});

Workgroup with a bytes-scanned cost guardrail

const wg = yield* AWS.Athena.WorkGroup("Guarded", {
outputLocation: "s3://my-results-bucket/prefix/",
bytesScannedCutoffPerQuery: 10_000_000, // 10 MB per query
publishCloudWatchMetricsEnabled: true,
});