Overview
Serverless query service to analyze data directly in S3 using standard SQL.
Built on Presto engine.
No infrastructure to manage, no data loading — data stays in S3.
QuickSight can connect to Athena for dashboards and data visualization.
Pricing
Pay per query, based on the amount of data scanned (~$5 per TB scanned).
Less data scanned = cheaper and faster → this drives all the performance tips.
Performance Improvement
- Use columnar formats — Parquet or ORC (instead of CSV/JSON) so only needed columns are scanned. Use Glue to convert to these formats.
- Compress data — bzip2, gzip, lz4, snappy, zstd, etc. to reduce data scanned.
- Partition datasets — organize data in S3 by columns (e.g.
s3://bucket/year/month/day/) so queries only scan relevant partitions. - Use larger files — bigger files (>128MB) minimize overhead vs many small files.
Federated Query
- Run SQL queries across data sources beyond S3 — both relational and non-relational, AWS and on-premises.
- Uses Data Source Connectors that run on AWS Lambda to execute the federated queries.
- Example sources: RDS, DynamoDB, Redshift, CloudWatch Logs, ElastiCache, on-prem databases.
- Query results can be stored back in S3.
Athena vs Redshift
- Athena is fully serverless; data stays in S3 (good for ad-hoc queries on S3 data).
- Redshift is a provisioned/serverless data warehouse, faster for complex repeated queries thanks to indexing and pre-loaded data.
- See [[Redshift]].
Exam Tips
- "Analyze / query data in S3 with SQL, serverless" → Athena.
- "Reduce Athena cost / improve performance" → columnar format (Parquet/ORC) + compression + partitioning.
- Common combo: S3 + Athena + QuickSight = serverless analytics & BI.
- Query logs (VPC Flow Logs, ELB logs, CloudTrail) stored in S3 → Athena.