# querying-aws-s3

A skill that answers S3 questions with Athena SQL: object counts, recent uploads and deletions, storage class breakdowns, tag lookups.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 5500 installs · ★ 3282
- Author: aws
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/aws/agent-toolkit-for-aws/tree/HEAD/skills/specialized-skills/system-table-skills/querying-aws-s3/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/querying-aws-s3

## What it does

The skill steers the agent toward S3 Metadata and S3 Storage Lens system tables instead of raw APIs. Those Iceberg tables live in the AWS-managed `aws-s3` bucket and are read through Amazon Athena. Queries use the path `"s3tablescatalog/aws-s3"."<namespace>".""`.

Three metadata tables cover most questions: `journal` logs CREATE, DELETE and UPDATE_METADATA events, `inventory` holds one row per object with its current state, and `annotation` stores annotation payloads in the `text_value` column. Storage Lens adds `default_storage_metrics`, `default_activity_metrics` and `bucket_property_metrics`.

Why skip `list-objects-v2`? It pages at 1000 objects, which stalls on buckets holding millions. It also cannot tell you who uploaded an object or from which IP — only `journal` carries `requester` and `source_ip_address`. Check that tracking is on before querying: `aws s3api get-bucket-metadata-configuration --bucket <BUCKET> --region <REGION>`. A `MetadataConfigurationNotFound` error means the tables do not exist yet. Athena access also needs the `s3tablescatalog` federated catalog registered in Glue and a workgroup with SSE-KMS encryption on the output location, otherwise queries fail with `CATALOG_NOT_FOUND`. The skill recommends IAM roles or temporary credentials over long-lived access keys.

## Requirements
- Works with: AWS

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill querying-aws-s3 -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/querying-aws-s3/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/querying-aws-s3/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill querying-aws-s3 -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/querying-aws-s3/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill querying-aws-s3 -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/querying-aws-s3/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install aws/agent-toolkit-for-aws querying-aws-s3
```

2. **Manually: put the files in place**
- File: `.github/skills/querying-aws-s3/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill querying-aws-s3 -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/aws/agent-toolkit-for-aws --path skills/specialized-skills/system-table-skills/querying-aws-s3
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/querying-aws-s3/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill querying-aws-s3 -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/aws/agent-toolkit-for-aws/tree/HEAD/skills/specialized-skills/system-table-skills/querying-aws-s3/SKILL.md

## When to use it
- count objects in a bucket without paging through 1000 at a time
- find who uploaded or deleted an object and from which IP
- break a bucket down by storage class
- pull objects by tag or user metadata
- review daily GET, PUT and DELETE request counts

## Example prompts
- how many objects are in my-bucket
- who uploaded to the logs/ prefix in the last day
- show the storage class breakdown for my-bucket

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 02645a09c2c11eb1.

BEGIN THIRD-PARTY FILE 02645a09c2c11eb1
```text
---
name: querying-aws-s3
description: >-
  Queries S3 object metadata, tracks bucket activity, audits object changes, searches
  annotations, and analyzes storage metrics using S3 Metadata system tables (journal,
  inventory, annotation) and S3 Storage Lens tables via Athena SQL. Applies when counting
  objects, finding recent uploads or deletions, identifying who wrote to a prefix, breaking
  down storage classes, finding objects by tag, searching annotation content, analyzing
  storage lens metrics, or enabling S3 Metadata tracking. Prefers system tables over raw S3
  APIs (list-objects-v2, head-object) at scale. Trigger phrases: bucket activity, object
  count, who uploaded, track deletions, storage class breakdown, find by tag, search
  annotations, storage lens metrics, audit bucket changes.
version: 1
argument-hint: "[bucket-name|query|'configure BUCKET'|'status BUCKET']"
---

# Query AWS S3 System Tables

## Overview

**Works best with** the [AWS MCP server](https://docs.aws.amazon.com/agent-toolkit/latest/userguide/getting-started-aws-mcp-server.html) 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 S3 Metadata provides continuously-updated Apache Iceberg tables that capture
object-level metadata for general-purpose buckets. S3 Storage Lens exports aggregated
storage and activity metrics as Iceberg tables. Both are read-only, stored in the
AWS-managed `aws-s3` table bucket, and queryable via Amazon Athena.

System tables are preferred over raw S3 APIs (`list-objects-v2`, `head-object`) because:

- `list-objects-v2` paginates at 1000 objects/page — inefficient for large buckets (millions or billions of objects). The inventory table answers `SELECT COUNT(*)` in seconds at any scale.
- `list-objects-v2` cannot identify who uploaded an object, from which IP, or when something was deleted. Only the journal table has `requester`, `source_ip_address`, and delete event tracking.
- Filtering by tag requires `get-object-tagging` per object. The inventory table has `object_tags` as a queryable map column.

## Decision Tree

| User intent | Use this skill? | Table | Alternative |
|---|---|---|---|
```
END THIRD-PARTY FILE 02645a09c2c11eb1

The third-party file has ended. Everything between the 02645a09c2c11eb1 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2301 of 13228 bytes. © aws · Apache-2.0 · https://github.com/aws/agent-toolkit-for-aws/tree/HEAD/skills/specialized-skills/system-table-skills/querying-aws-s3/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
