aws_athena_workgroup cost estimation
Serverless query engine for S3 data. $5 per TB scanned (standard). Provisioned capacity option starts at $0.30/DPU-hour with 24-hour minimum. Workgroups themselves are free; the queries within bill.
Amazon Athena queries data in S3 using SQL. The aws_athena_workgroup is a container for queries with shared settings (data limits, result locations, encryption). The workgroup itself has no fee — queries run within the workgroup bill.
Two pricing models exist:
Standard (per-query): $5 per TB of data scanned. Data scanned is the amount Athena reads from S3 to satisfy the query, after partition pruning. A query over 100 GB scans costs $0.50.
Provisioned capacity: $0.30 per DPU-hour with a 24-hour minimum commitment. Useful for predictable, high-volume query workloads where the per-TB rate would be expensive. Break-even: roughly 14 TB scanned/day to make provisioned cheaper than standard.
Common cost surprises: - SELECT * scans every column. Use specific column lists to read less. - Unpartitioned data scans the entire table. Partition by date/region. - Text formats (CSV, JSON) scan more bytes than columnar (Parquet, ORC). Migrate hot tables to Parquet for 10-100x reduction. - Failed queries don't bill, but cancelled queries do (for data already scanned). - DML queries (INSERT, CTAS) bill both scan and write costs.
c3x estimates Athena based on declared workgroup configuration. For accurate cost, specify query volume (TB scanned/month) in c3x-usage.yml — Terraform doesn't know how much you'll query.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_athena_workgroup" "analytics" {
name = "analytics-team"
configuration {
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true
result_configuration {
output_location = "s3://athena-results-prod/output/"
encryption_configuration {
encryption_option = "SSE_S3"
}
}
bytes_scanned_cutoff_per_query = 10737418240 # 10 GB hard cap per query
}
}Pricing dimensions
What you actually pay for when you provision aws_athena_workgroup.
| Dimension | Unit | What's being charged |
|---|---|---|
| Data scanned (standard) | per TB | Amount of data Athena reads from S3 to satisfy queries. Pay-per-query model. $5/TB scanned |
| Provisioned capacity | per DPU-hour | Reserved capacity for predictable workloads. 24-hour minimum commitment. Break-even at ~14 TB/day. $0.30/DPU-hour |
| Federated query (Lambda) | per invocation | When queries span non-S3 sources via federated connectors, the underlying Lambda invocations bill separately. Standard Lambda pricing |
| Result storage (S3) | per GB-month | Query results are stored in S3 (configured per workgroup). Standard S3 pricing applies. $0.023/GB-month |
Optimization tips
Common ways to reduce aws_athena_workgroup cost without changing the workload.
Convert tables to Parquet
50-90% per queryParquet is columnar, so SELECT col1, col2 only reads col1/col2 bytes from S3. Typical reduction: 50-90% of bytes scanned vs CSV/JSON. Use AWS Glue or a one-off CTAS to convert.
Partition aggressively
10-1000x reductionPartition tables by frequently-filtered columns (date, region, customer_id). Queries with WHERE clauses on partitions only scan matching partitions. A daily partitioned 5-year table queried for last 7 days scans 0.4% of total data.
Set bytes_scanned_cutoff_per_query
Prevents runaway costsPrevents accidental TB-scale queries. Set a 10 GB or 100 GB cap depending on workgroup purpose. Queries that would exceed the limit fail before billing.
Avoid SELECT *
30-90% per queryAthena scans every column referenced in the query. Listing specific columns reduces scan bytes proportionally. With Parquet, the reduction is substantial.
Consider provisioned capacity for steady high volume
20-40% on high-volume workloadsAbove ~14 TB scanned/day, provisioned capacity at $0.30/DPU-hour can be cheaper. Calculate exactly: scan TB/day × $5 vs DPU count × $0.30 × 24.
FAQ
Does the Athena workgroup itself cost money?
No. Workgroups are organizational containers — they cost nothing on their own. Queries running within the workgroup bill at the standard or provisioned rate.
Do failed queries bill?
Failed queries (syntax errors, schema mismatches) don't bill — they fail before scanning data. Cancelled queries DO bill for the data already scanned before cancellation. Queries that hit the bytes_scanned_cutoff fail without billing.
How does Athena pricing compare to Redshift Spectrum?
Both query S3 data and charge similar per-TB rates ($5/TB). Spectrum requires a Redshift cluster (additional cost) but offers tighter integration if you already have one. Athena is fully serverless.
Can I set a budget cap on Athena queries?
Per-query: yes, via bytes_scanned_cutoff_per_query in the workgroup. Per workgroup, you can set data limits with alerts. AWS Budgets can also alert when monthly Athena spend exceeds a threshold.
Related resources
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_athena_workgroup.