analyzing-release-read…
Trigger a pre-merge code change risk analysis on a GitHub PR, GitLab MR, or local branch. Use when the user wants to analyze code…
Runs SQL queries on Amazon Athena query history exported as an Apache Iceberg table in S3 Tables. The query_executions system table captures per-query metadata (query text, IAM principal, work group, statement type, data scanned, timing breakdown, error details, tables accessed,
Claude Code
$ npx -y skills add aws/agent-toolkit-for-aws --skill querying-aws-athena --agent claude-code
Codex
$ npx skills add aws/agent-toolkit-for-aws --skill querying-aws-athena -a codex -y
Cursor
$ npx skills add aws/agent-toolkit-for-aws --skill querying-aws-athena -a cursor -y
Gemini CLI
$ npx skills add aws/agent-toolkit-for-aws --skill querying-aws-athena -a gemini-cli -y
GitHub Copilot
$ npx skills add aws/agent-toolkit-for-aws --skill querying-aws-athena -a github-copilot -y
OpenCode
$ npx skills add aws/agent-toolkit-for-aws --skill querying-aws-athena -a opencode -y
Windsurf
$ npx skills add aws/agent-toolkit-for-aws --skill querying-aws-athena -a windsurf -y
name: querying-aws-athena description: >- Runs SQL queries on Amazon Athena query history exported as an Apache Iceberg table in S3 Tables. The query_executions system table captures per-query metadata (query text, IAM principal, work group, statement type, data scanned, timing breakdown, error details, tables accessed, result reuse, engine version) for every completed query. Applies when analyzing Athena usage and cost, finding who ran a query, auditing table access, tracking data scanned by user or work group, investigating slow or failed queries, detecting performance regressions, reporting query history beyond the 45-day API window, or enabling Athena system tables. Prefers the system table over the ListQueryExecutions and GetQueryExecution APIs at scale. Trigger phrases: Athena query history, who ran this query, data scanned by user, most queried tables, slowest queries, failed query analysis, Athena cost by work group, query audit trail, enable Athena system tables. version: 1 argument-hint: "[query|'configure'|'status']"
**Works best with** the [AWS MCP server](https://docs.aws.amazon.com/aws-mcp/) for sandboxed execution and audit logging. All commands below use the AWS CLI and work in any environment with configured AWS credentials. Use IAM roles or temporary credentials; avoid long-lived access keys.
Amazon Athena system tables are Apache Iceberg tables that Athena automatically creates and populates with account usage data. The `query_executions` system table records one row per completed query with the metadata from `GetQueryExecution` plus additional fields that `GetQueryExecution` does not return. The tables are read-only and stored as fully managed Amazon S3 Tables in the service-managed `aws-athena` S3 table bucket in your account and Region, and are queryable with Athena SQL (the focus of this skill) or any other Iceberg-compatible engine, such as Amazon Redshift.
The system table is preferred over the raw Athena APIs (`ListQueryExecutions`, `GetQueryExecution`) because:
| User intent | Use this skill? | Column / approach | Alternative | |---|---|---|---| | How many queries ran, and cost/data-scanned trends | **Yes** | `data_scanned_size`, `submission_date_time` | — | | Who ran a specific query, or who scans the most | **Yes** | `principal_arn` | — | | Which tables are queried most / by whom | **Yes** | `tables_accessed` (UNNEST) | — | | Slowest queries / time breakdown / regressions | **Yes** | timing `*_duration` columns | — | | Failed-query analysis, error patterns | **Yes** | `state_enum`, `error_*` columns | — | | Query history older than 45 days | **Yes** | system table (API window is 45 days) | — | | Status of a single in-flight/running query | **No** | — | `GetQueryExecution` (system table has completed queries only) | | Look up one known query by ID, ad hoc | **Maybe** | one-row `WHERE query_execution_id =` | `GetQueryExecution` (no setup) | | Enable / disable the system table | **Yes** | see Enable section | — | | Query the data *inside* S3 tables | **No** | — | `querying-data-lake` |
Before querying, confirm the system table is enabled for the account and Region.
aws athena get-system-table-configuration --table-name ALL --region <REGION> aws athena list-system-table-statuses --region <REGION>
**Interpret the response:**
The physical `query_executions` table is created by the ingestion pipeline on the first data delivery after enabling, so it may not exist immediately after opt-in even though the configuration shows enabled.
System tables are an account- and Region-level switch. The `TableName` parameter is always `ALL`; there is no per-work-group opt-in.
> **Before enabling — this captures sensitive data account-wide.** Enabling records the verbatim `query_string` (which may contain PII, secrets, or business logic) and the `principal_arn` for *every* completed query in *every* work group, including ones created later. Review [Data Sensitivity](#data-sensitivity) and decide on a customer-managed KMS key and Lake Formation column controls *before* turning it on.
**Enable with default encryption (SSE-S3)** — acceptable only for non-sensitive usage data. Because this table captures `query_string` and `principal_arn` verbatim, SSE-S3 is **not recommended for production**; prefer the customer-managed SSE-KMS form below whenever the query history may contain sensitive data:
aws athena create-system-table-configuration --table-name ALL --region <REGION>
**Enable with a customer-managed KMS key (
Help AI coding agents build, deploy, and manage applications on AWS. The Agent Toolkit for AWS gives AI coding agents the tools, knowledge, and guardrails they need to work with AWS services.
Trigger a pre-merge code change risk analysis on a GitHub PR, GitLab MR, or local branch. Use when the user wants to analyze code…
Have a fast, conversational analysis with the AWS DevOps Agent. Use for cost optimization, architecture review, topology mapping,…
Coordinate the AWS DevOps Agent across multiple AgentSpaces from one Claude Code session — route questions to the right space…
Run a fast AWS Security Agent diff scan on only the changed code since a git ref. Use when the user asks to scan changes, run a…
Run a deep root-cause investigation on the AWS DevOps Agent. Use when the user describes an incident, alarm, outage, or…
Run an AWS Security Agent penetration test against a live web application — registers and verifies the target domain, exercises…
Use when running, building, or managing Linux containers on macOS, or when a task involves Docker, docker compose, Lima, Colima,…
Operate FrontendExtension (FE) resources in frontend-forge: create, update, rebuild, inspect package artifacts, download…
Build, debug, or review Cloudflare Agents SDK applications using the agents package.
Use when writing, reviewing, or debugging Terraform/OpenTofu modules, tests, CI, scans, or state ops - diagnoses failure mode…