Skip to content

How exactly is Athena SDK billed?

0

I am currently running a Lambda function, which uses Athena SDK for running SQL queries on a Glue Table. I am wondering how will this Lambda be billed? Will the cost for running the Athena SDK be added onto this as well? How would I calculate this cost?

1 Answer
1
Accepted Answer

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:

  1. The number of requests to your function
  2. The duration of execution (calculated in GB-seconds based on memory allocation)
  3. Any additional ephemeral storage beyond the free tier

For the Athena queries executed through the SDK, you'll be charged:

  1. $5 per TB of data scanned, rounded up to the nearest megabyte with a 10 MB minimum per query
  2. Standard S3 rates for storing query results in your designated S3 bucket
  3. 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:

  1. Compress your data
  2. Partition your data
  3. 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

answered 8 months ago
AWS
EXPERT
reviewed 8 months ago
EXPERT
reviewed 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.