aws/agent-toolkit-for-aws/querying-aws-redshift
Claude Code and agent skill by aws/agent-toolkit-for-aws
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
Enables Redshift system-table (SYS_*) log publishing to S3 Tables in Apache Iceberg format for both Provisioned clusters and Serverless namespaces, verifies publishing status, and queries the published logs via any Iceberg-compatible engine including Redshift and Athena. Covers system tables such as sys_query_history, sys_query_text, sys_connection_log, sys_query_detail, and sys_session_history. Applies when turning on S3 Tables log publishing for a cluster or namespace, confirming publishing status and locating the S3 Tables namespace, querying non-realtime data from Redshift system tables off-cluster at scale, or building dashboards for Redshift monitoring and auditing, especially for historical or high-volume system-table data beyond the in-cluster SYS_ view retention window. Trigger phrases: publish redshift system table log to s3 tables, enable-logging s3 tables, describe redshift logging status, query redshift system tables in athena or redshift, redshift log exports to iceberg.
Install
npx vskill@latest install aws/agent-toolkit-for-aws/querying-aws-redshiftSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as aws/agent-toolkit-for-aws/querying-aws-redshift.
Query AWS Redshift System Tables
Overview
Works best with the AWS MCP server 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.
Redshift can publish system tables — the SYS_* monitoring data such as sys_query_history, sys_query_detail, and sys_connection_log — to S3 Tables as continuously-updated Apache Iceberg tables.
Terminology used throughout: system table refers to a SYS_* dataset generally, and each one maps 1:1 to a published Iceberg table. Where this skill says `SYS_` view, it means specifically the live in-cluster object you query on the cluster itself — that is a view, and it is a different thing from the published S3 Tables copy. This applies to both Provisioned clusters and Serverless namespaces. It is an opt-in extension of the existing logging APIs. Published tables are read-only, stored in the AWS-managed aws-redshift table bucket, and queryable via any Iceberg-compatible engine including Amazon Athena and Amazon Redshift itself.
Querying the S3 Tables copy is preferred over the live in-cluster SYS_ views when analyzing historical or high-volume system-table data because:
- The in-cluster
SYS_views have a limited retention window; S3 Tables retains history well beyond it. - Querying S3 Tables adds no load to the running Redshift cluster.
- The logs are Iceberg tables, so they can be queried at scale from any Iceberg-compatible engine and joined with other lake data.
Decision Tree
| User intent | Use this skill? | Alternative | |
|---|---|---|---|
| Turn on S3 Tables log publishing for a cluster or namespace | Yes | — | |
| Confirm a cluster/namespace is publishing / find its S3 Tables namespace | Yes | — | |
| Querying non-realtime data from Redshift system tables | Yes | — | |
| Build daily/weekly/monthly dashboard for Redshift monitoring and auditing | Yes | — | |
| Selectively stop S3 Tables publishing | Yes | — | |
| Query published system tables from Redshift (cross-database) | Yes | — | |
| Query published system tables from Athena | Yes | — | |
Inspect the current, real-time SYS_ state on a live cluster | No | Query the SYS_ view on the cluster directly | |
| Query data inside customer tables | No | Direct Redshift SQL on the cluster |
Supported Data Sources
| Compute type | Enable / disable API | Status API | Granularity options | |
|---|---|---|---|---|
| Redshift Provisioned cluster | redshift enable-logging / redshift disable-logging | redshift describe-logging-status | cluster (default), account | |
| Redshift Serverless namespace | redshift-serverless update-namespace with --s3-table-action Enable/Disable | redshift-serverless get-namespace | namespace (default), account |
Both compute types publish into the same AWS-managed aws-redshift table bucket and are queried identically once published. They differ only in the enable/disable API surface and in the casing of the status response — see the flag and field tables in Common Tasks.
Not covered by this skill: Redshift audit logs delivered to S3 or CloudWatch (useractivitylog, userlog, connectionlog), which use the separate --log-exports mechanism on Serverless and are not SYS_* system tables.
Common Tasks
1. Check If Configured
Before querying, confirm the cluster or namespace is publishing to S3 Tables.
Interpret the response. The two compute types return the same information under different field names and casing — Provisioned uses PascalCase under S3Tables, Serverless uses camelCase under namespace.s3TablePublishStatus:
| Meaning | Provisioned (describe-logging-status) | Serverless (get-namespace) | |
|---|---|---|---|
| Not enabled | LoggingEnabled: false or no S3Tables block | no s3TablePublishStatus block | |
| Destination includes S3 Tables | LogDestinationType contains s3table | logDestinationType contains s3table | |
List of published SYS_* tables | S3Tables.S3Tables | namespace.s3TablePublishStatus.s3Tables | |
| The exact S3 Tables namespace (required for querying) | S3Tables.S3TableNamespace | namespace.s3TablePublishStatus.s3TableNamespace | |
| Granularity | S3Tables.S3TableGranularity (cluster/account) | namespace.s3TablePublishStatus.s3TableGranularity (namespace/account) | |
| Per-table last ingest time | S3Tables.LastIngestionTimes | namespace.s3TablePublishStatus.lastIngestionTimes | |
| All available system tables published | S3Tables.EnabledAll | namespace.s3TablePublishStatus.enabledAll |
Notes:
LogDestinationTypeis a comma-joined list when more than one destination is active — e.g."cloudwatch,s3table". Test with a substring/contains check, not equality againsts3table.- An empty
LastIngestionTimes/lastIngestionTimesmap, or a table listed as published but absent from the map, means data for that table may still be in flight. Compare successive values to confirm new data is landing. - On Serverless, do not read the top-level
logExportsfield for this feature — that field carries the CloudWatch/S3 audit logs (useractivitylog,userlog,connectionlog) and is unrelated toSYS_*S3 Tables publishing.
2. Enable (if not configured)
--s3-table-kms-key-id is part of both commands deliberately, not an optional add-on. Omitting it does not fail — the tables fall back to an AWS-owned key you cannot audit, restrict by policy, or revoke. Because SYS_* tables carry query_text, user_name, and remote_host, treat the customer-managed key as the default and drop the flag only for throwaway environments.
Enable from AWS console Amazon Redshift Console > Clusters > select your cluster > Tabs > Integrations / System table integration
The two compute types take different flags for the same feature. Do not carry Provisioned flag names over to Serverless:
| Purpose | Provisioned (enable-logging) | Serverless (update-namespace) | |||
|---|---|---|---|---|---|
| Which system tables to publish | --log-exports | --s3-table-names | |||
| Enable vs disable | separate enable-logging / disable-logging operations | --s3-table-action Enable \ | Disable | ||
| Granularity | --s3-table-granularity cluster \ | account | --s3-table-granularity namespace \ | account | |
| Customer-managed KMS key | --s3-table-kms-key-id | --s3-table-kms-key-id | |||
| Validate without applying | --dry-run | --dry-run |
Notes:
- Granularity: Provisioned supports
cluster(default) oraccount; Serverless supportsnamespace(default) oraccount. cluster/namespacegranularity → one S3 table per cluster/namespace;account→ one shared table for all clusters/namespaces per account per region.- Use
allto publish all availableSYS_*tables —--log-exports allon Provisioned,--s3-table-names allon Serverless. - Encryption at rest is strongly recommended for production. Without
--s3-table-kms-key-idthe published tables are encrypted with an AWS-owned key, which you cannot audit, restrict by policy, or revoke.SYS_*tables carryquery_text,user_name, andremote_host(see Security Considerations), so pass a customer-managed key. Grant key access using the complete key policy in${SKILL_DIR}/references/security.mdrather than an abbreviated action list — it needs two service principals (systemtables.redshift.amazonaws.comfor publishing andmaintenance.s3tables.amazonaws.comfor table maintenance/compaction). Provisioning only the publishing principal lets writes succeed while compaction silently fails. - Both operations accept
--dry-runto validate the request without changing anything. Provisioned returns aDryRunOperationerror on success ("Request would have succeeded, but DryRun flag is set"); Serverless returns an empty body and exit code 0. Note that the Serverless dry-run validates request shape only, not parameter values, so a successful dry-run there does not guarantee the values are accepted.
Disable selectively:
3. Verify Permissions
Full setup commands for both paths: `${SKILL_DIR}/references/permissions-setup.md`. Load it before creating roles or registering resources.
Athena path — needs the s3tablescatalog/aws-redshift catalog registered in Glue, a workgroup with an output location, and S3 Tables read permissions. Confirm the catalog is queryable:
Namespaces returned → registered and queryable. EntityNotFoundException / CATALOG_NOT_FOUND → the S3 Tables integration is not enabled (S3 console > Table buckets > Enable integration). Encrypt the workgroup output location — Athena writes full result sets, including query_text and user_name, to S3.
Redshift auto-mount path — needs a Provisioned RA3 cluster and a four-step setup: create the query_s3_tables role (trust policy must name both redshift.amazonaws.com and lakeformation.amazonaws.com, the latter with all four of sts:AssumeRole, sts:SetContext, sts:SetSourceIdentity, sts:TagSession), attach it to the cluster, register the table bucket with Lake Formation, and add the Redshift service-linked roles to ReadOnlyAdmins. Constraints that cause most failures:
- Condition both trust statements on `aws:SourceAccount` — a bare service principal is a confused-deputy risk.
- Do not attach `AWSLakeFormationDataAdmin` to the cluster's query role. It is needed only by the principal performing setup, and only during setup. The cluster's role needs read access alone.
- Auto-mount is a poll, not a callback — the catalog can take up to 300 seconds to appear in
pg_database. A cluster reboot forces immediate discovery.
4. Identify the Target Table
Namespace — resolve it from the API, do not construct it:
- Read
S3Tables.S3TableNamespacefromdescribe-logging-status(Provisioned) ors3TablePublishStatus.s3TableNamespacefromget-namespace(Serverless) and use it verbatim. - Optional sanity check only: the API value typically follows
<namespace_arn_id>_sysforcluster/namespacegranularity and<account>_sysforaccountgranularity. Use this only to verify the value looks right — never to generate the namespace when the API response is unavailable.
Table — each publishable system table maps 1:1 to a table in the aws-redshift table bucket. Do not work from a memorized list — resolve it at runtime, in this order:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/specialized-skills/system-table-skills/querying-aws-redshift/SKILL.md
Popularity
- Repository stars
- 2,779
- Repository forks
- 341
- 7-day trend score
- 40
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aws/agent-toolkit-for-aws/querying-aws-redshift)