aws-athena
TLDR
Start a query execution
SYNOPSIS
aws athena command [options]
DESCRIPTION
aws athena manages Amazon Athena, an interactive query service for analyzing data in Amazon S3 using standard SQL. Athena is serverless, requiring no infrastructure setup.
Queries are executed asynchronously via start-query-execution, which returns a query execution ID. Use get-query-execution to check status and get-query-results to retrieve results once complete. Results are also stored in the specified S3 output location.
Workgroups organize queries and control settings like result locations, encryption, and query limits. The --query-execution-context parameter specifies which database and data catalog to query against.
Athena uses the AWS Glue Data Catalog to store table metadata, or you can use an external Hive metastore. Tables are created over data in S3 using DDL statements like CREATE EXTERNAL TABLE.
PARAMETERS
start-query-execution
Execute a SQL query asynchronouslyget-query-execution
Get information about a query executionget-query-results
Retrieve results of a completed querystop-query-execution
Cancel a running querylist-query-executions
List query execution IDslist-databases
List databases in a data cataloglist-table-metadata
List tables in a databasecreate-work-group
Create a workgroup for queriesget-work-group
Get workgroup configuration--query-string sql
SQL statement to execute--query-execution-id id
Identifier of query execution--work-group name
Workgroup to run the query in--query-execution-context context
Database and catalog context (Database=db,Catalog=catalog)--result-configuration config
Output location and encryption settings (OutputLocation=s3://path/)--max-results n
Maximum results to return
CAVEATS
Queries are charged based on data scanned; use partitioning and columnar formats (Parquet, ORC) to reduce costs. Query results expire after a configured period. Long-running queries may timeout. Requires appropriate IAM permissions for S3 data access and Glue catalog.
HISTORY
Amazon Athena was launched in November 2016 as a serverless query service based on Presto. It enables SQL queries on S3 data without provisioning infrastructure. Athena integrates with AWS Glue for schema discovery and supports ANSI SQL with extensions for nested data types common in analytics workloads.


