AWS Redshift Skills
A Python skill for interacting with AWS Redshift across two deployment modes: Redshift Provisioned and Redshift Serverless, plus a shared Data API for SQL execution.
When to Use (Trigger Phrases)
Invoke this skill when the user mentions:
"List Redshift clusters"
"Create a Redshift cluster"
"Pause my Redshift cluster"
"List Redshift Serverless workgroups"
"Create a namespace"
"Run a SQL query on Redshift"
"Execute COPY from S3 to Redshift"
"UNLOAD data to S3"
"Check query status"
"List tables in Redshift"
"Describe Redshift table columns"
"Resize my Redshift cluster"
Any request involving Redshift Provisioned clusters/snapshots, Redshift Serverless workgroups/namespaces, or Data API SQL execution.
Feature List
Redshift Provisioned
- - Clusters: List, describe, create, delete, resize, pause, resume, reboot clusters
- Snapshots: Create, describe, restore from, delete snapshots
Redshift Serverless
- - Workgroups: List, get, create, update, delete workgroups (RPU configuration)
- Namespaces: List, get, create, delete namespaces (database configuration)
Redshift Data API
- - SQL Execution: Execute single or batch SQL statements (async or sync with polling)
- Results: Get query results with pagination
- Lifecycle: Describe statement status, list recent statements, cancel running queries
- Metadata: List databases, schemas, tables; describe table columns
- Data Movement: COPY from S3, UNLOAD to S3
Initial Setup
- 1. Python 3.8+ with
boto3>=1.26.0:
CODEBLOCK1
- 2. AWS credentials via boto3 default chain (env vars, config files, IAM roles).
- 3. Environment variables (all optional, validated at point of use):
CODEBLOCK2
How to Manage Redshift
1. Redshift Provisioned
Traditional Redshift provisioned clusters with dedicated compute nodes.
- - Cluster & snapshot management:
scripts/provisioned/redshift_provisioned_cli.py — 12 @tool functions - Detailed guide:
references/provisioned/cluster_guide.md — Cluster lifecycle, node types, resize - Detailed guide:
references/provisioned/snapshot_guide.md — Snapshot create/restore/share
2. Redshift Serverless
Fully managed serverless data warehouse with automatic scaling.
- - Workgroup & namespace management:
scripts/serverless/redshift_serverless_cli.py — 9 @tool functions - Detailed guide:
references/serverless/workgroup_guide.md — Workgroup management - Detailed guide:
references/serverless/namespace_guide.md — Namespace management
3. Redshift Data API
SQL execution via the Data API. Works with both Provisioned and Serverless.
- - Query execution & metadata:
scripts/data_api/redshift_data_cli.py — 12 @tool functions - Detailed guide:
references/data_api/query_guide.md — SQL execution, COPY/UNLOAD
Available Scripts
| Script | Description |
|---|
| INLINECODE9 | Redshift Provisioned @tool functions (12 tools) |
| INLINECODE10 |
Redshift Serverless @tool functions (9 tools) |
|
scripts/data_api/redshift_data_cli.py | Redshift Data API @tool functions (12 tools) |
|
scripts/config/redshift_config.py | Unified configuration management |
|
scripts/client/boto_client.py | boto3 client factory |
References
| Document | Description |
|---|
| INLINECODE14 | Redshift Provisioned cluster management guide |
| INLINECODE15 |
Redshift snapshot management guide |
|
references/serverless/workgroup_guide.md | Redshift Serverless workgroup management guide |
|
references/serverless/namespace_guide.md | Redshift Serverless namespace management guide |
|
references/data_api/query_guide.md | Redshift Data API SQL execution guide |
Requirements
- - When writing temporary files (scripts, notes, etc.), place them in the
./tmp folder. - When importing scripts packages, add the skill root to path: INLINECODE20
- AWS credentials are handled by boto3's default credential chain — never pass access keys directly.
- All configuration environment variables are optional and validated at the point of use.
Data Privacy & Trust
- - No credential storage: AWS credentials are resolved via boto3 default chain. No keys are stored or logged.
- Secret masking: All functions automatically mask potential AWS credentials in output.
- Read-only by default: Most operations are read-only queries. Write operations (cluster creation, deletion) require explicit user action.
External Endpoints
This skill connects to:
- - AWS Redshift API (
redshift.{region}.amazonaws.com) - AWS Redshift Serverless API (
redshift-serverless.{region}.amazonaws.com) - AWS Redshift Data API (
redshift-data.{region}.amazonaws.com) - AWS S3 API (
s3.{region}.amazonaws.com) — for COPY/UNLOAD operations
AWS Redshift 技能
一个用于在两种部署模式下与 AWS Redshift 交互的 Python 技能:Redshift Provisioned 和 Redshift Serverless,以及一个用于 SQL 执行的共享 Data API。
使用时机(触发短语)
当用户提及以下内容时调用此技能:
列出 Redshift 集群
创建 Redshift 集群
暂停我的 Redshift 集群
列出 Redshift Serverless 工作组
创建命名空间
在 Redshift 上运行 SQL 查询
执行从 S3 到 Redshift 的 COPY
将数据 UNLOAD 到 S3
检查查询状态
列出 Redshift 中的表
描述 Redshift 表列
调整我的 Redshift 集群大小
任何涉及 Redshift Provisioned 集群/快照、Redshift Serverless 工作组/命名空间或 Data API SQL 执行的请求。
功能列表
Redshift Provisioned
- - 集群:列出、描述、创建、删除、调整大小、暂停、恢复、重启集群
- 快照:创建、描述、从快照恢复、删除快照
Redshift Serverless
- - 工作组:列出、获取、创建、更新、删除工作组(RPU 配置)
- 命名空间:列出、获取、创建、删除命名空间(数据库配置)
Redshift Data API
- - SQL 执行:执行单条或批量 SQL 语句(异步或带轮询的同步)
- 结果:获取带分页的查询结果
- 生命周期:描述语句状态、列出最近语句、取消正在运行的查询
- 元数据:列出数据库、模式、表;描述表列
- 数据迁移:从 S3 COPY、向 S3 UNLOAD
初始设置
- 1. Python 3.8+ 并安装 boto3>=1.26.0:
bash
pip install boto3>=1.26.0
- 2. AWS 凭证通过 boto3 默认链(环境变量、配置文件、IAM 角色)获取。
- 3. 环境变量(均为可选,在使用时验证):
bash
export AWS_REGION=us-east-1
# Redshift Provisioned
export REDSHIFTCLUSTERID=my-cluster
export REDSHIFT_DATABASE=dev
export REDSHIFTDBUSER=admin
# Redshift Serverless
export REDSHIFTWORKGROUPNAME=my-workgroup
export REDSHIFTNAMESPACENAME=my-namespace
# 共享
export REDSHIFTIAMROLE_ARN=arn:aws:iam::123456789:role/redshift-role
export REDSHIFTS3LOG_URI=s3://my-bucket/redshift-logs/
export REDSHIFTSECRETARN=arn:aws:secretsmanager:us-east-1:123456789:secret:my-secret
如何管理 Redshift
1. Redshift Provisioned
具有专用计算节点的传统 Redshift 预置集群。
- - 集群和快照管理:scripts/provisioned/redshiftprovisionedcli.py — 12 个 @tool 函数
- 详细指南:references/provisioned/clusterguide.md — 集群生命周期、节点类型、调整大小
- 详细指南:references/provisioned/snapshotguide.md — 快照创建/恢复/共享
2. Redshift Serverless
具有自动扩展功能的完全托管无服务器数据仓库。
- - 工作组和命名空间管理:scripts/serverless/redshiftserverlesscli.py — 9 个 @tool 函数
- 详细指南:references/serverless/workgroupguide.md — 工作组管理
- 详细指南:references/serverless/namespaceguide.md — 命名空间管理
3. Redshift Data API
通过 Data API 执行 SQL。适用于 Provisioned 和 Serverless。
- - 查询执行和元数据:scripts/dataapi/redshiftdatacli.py — 12 个 @tool 函数
- 详细指南:references/dataapi/query_guide.md — SQL 执行、COPY/UNLOAD
可用脚本
| 脚本 | 描述 |
|---|
| scripts/provisioned/redshiftprovisionedcli.py | Redshift Provisioned @tool 函数(12 个工具) |
| scripts/serverless/redshiftserverlesscli.py |
Redshift Serverless @tool 函数(9 个工具) |
| scripts/data
api/redshiftdata_cli.py | Redshift Data API @tool 函数(12 个工具) |
| scripts/config/redshift_config.py | 统一配置管理 |
| scripts/client/boto_client.py | boto3 客户端工厂 |
参考资料
| 文档 | 描述 |
|---|
| references/provisioned/clusterguide.md | Redshift Provisioned 集群管理指南 |
| references/provisioned/snapshotguide.md |
Redshift 快照管理指南 |
| references/serverless/workgroup_guide.md | Redshift Serverless 工作组管理指南 |
| references/serverless/namespace_guide.md | Redshift Serverless 命名空间管理指南 |
| references/data
api/queryguide.md | Redshift Data API SQL 执行指南 |
要求
- - 编写临时文件(脚本、笔记等)时,请将其放置在 ./tmp 文件夹中。
- 导入脚本包时,将技能根目录添加到路径:sys.path.append(${redshiftskillroot})
- AWS 凭证由 boto3 的默认凭证链处理 — 切勿直接传递访问密钥。
- 所有配置环境变量均为可选,并在使用时进行验证。
数据隐私与信任
- - 无凭证存储:AWS 凭证通过 boto3 默认链解析。不存储或记录任何密钥。
- 密钥屏蔽:所有函数自动屏蔽输出中潜在的 AWS 凭证。
- 默认只读:大多数操作为只读查询。写操作(集群创建、删除)需要用户明确操作。
外部端点
此技能连接到:
- - AWS Redshift API(redshift.{region}.amazonaws.com)
- AWS Redshift Serverless API(redshift-serverless.{region}.amazonaws.com)
- AWS Redshift Data API(redshift-data.{region}.amazonaws.com)
- AWS S3 API(s3.{region}.amazonaws.com)— 用于 COPY/UNLOAD 操作