- Newest
- Most votes
- Most comments
When you use the Athena SDK within a Lambda function to run SQL queries on a Glue table, you'll be billed for both the Lambda execution and the Athena queries separately.
For the Lambda function itself, you'll be charged based on:
- The number of requests to your function
- The duration of execution (calculated in GB-seconds based on memory allocation)
- Any additional ephemeral storage beyond the free tier
For the Athena queries executed through the SDK, you'll be charged:
- $5 per TB of data scanned, rounded up to the nearest megabyte with a 10 MB minimum per query
- Standard S3 rates for storing query results in your designated S3 bucket
- AWS Glue Data Catalog standard rates if you're using the Glue Data Catalog with Athena
You won't be charged for DDL statements (CREATE/ALTER/DROP TABLE), partition management statements, or failed queries. Canceled queries are charged based on the amount of data scanned.
To optimize costs, you can:
- Compress your data
- Partition your data
- Convert your data to columnar formats (like Parquet)
These optimizations can reduce your Athena costs by 30% to 90% per query by minimizing the amount of data scanned. For example, converting to columnar formats allows Athena to read only the columns needed for your query.
If your queries access federated data sources (data not stored in S3), additional Lambda charges will apply for the Lambda functions that execute those federated queries.
Sources
Amazon Athena - Big Data Analytics Options on AWS
Amazon Athena Pricing – Serverless Interactive Query Service – Amazon Web Services
BIlling details of Lamba usage | AWS re:Post
Serverless Computing – AWS Lambda Pricing – Amazon Web Services
Relevant content
- asked 4 years ago
- AWS OFFICIALUpdated 4 months ago
