AI coding agents are changing how developers interact with cloud infrastructure and databases. Instead of manually searching documentation and writing every query from scratch, developers can describe a task in natural language and use an AI assistant to help explore schemas, generate SQL, and investigate database problems.
With Agent Toolkit for AWS and Amazon Redshift integration, developers can bring these workflows into coding environments such as Claude Code, Kiro, and Cursor.
In this tutorial, we'll explore the concept and build a small sales analytics project using Amazon Redshift and SQL.
What is Redshift in the Agent Toolkit?
Amazon Redshift is an AWS cloud data warehouse designed for analytics and SQL-based workloads.
Agent Toolkit for AWS provides integrations and specialized skills that help supported AI coding agents work with AWS services. For Redshift-related workflows, these capabilities can help developers:
- Discover tables, columns, and database metadata.
- Generate and explain SQL queries.
- Analyze sales and reporting data.
- Troubleshoot SQL errors and performance issues.
- Review analytical query patterns and materialized views.
- Assist with data warehouse migration and validation workflows.
The agent helps developers understand and work with the data warehouse. It does not eliminate the need to review SQL, validate results, or control permissions.
Official announcement: https://aws.amazon.com/about-aws/whats-new/2026/08/redshift-agenttoolkit-for-ai-assisted-datawarehouse-mgmt/
How the workflow works
A simplified architecture looks like this:
Developer
|
v
AI Coding Agent
(Claude Code / Kiro / Cursor)
|
v
Agent Toolkit for AWS
|
v
Configured AWS Tools and Permissions
|
v
Amazon Redshift
|
v
Query Results and Recommendations
The developer describes a task, the agent uses its configured capabilities to help perform it, and Redshift returns the query results.
Actual functionality depends on the installed integrations, AWS credentials, region, and database permissions.
Project: Investigate a sales revenue decline
Imagine your business team reports that revenue is declining in one region. You want to analyze daily sales and identify where the change occurred.
For this demonstration, we'll use fictional sales data.
Prerequisites
You'll need:
- An Amazon Redshift Serverless workgroup or provisioned cluster.
- A database and schema where you can create a sample table.
- Appropriate AWS credentials and database permissions.
- A supported coding agent with Agent Toolkit for AWS configured.
For learning, use a development environment and non-sensitive data.
Getting started with Redshift: https://docs.aws.amazon.com/redshift/latest/gsg/getting-started.html
Step 1: Create a sales table
Run this SQL in your authorized Redshift query editor:
CREATE TABLE sales_orders (
order_id INTEGER,
order_date DATE,
region VARCHAR(50),
revenue DECIMAL(12, 2),
status VARCHAR(20)
);
Step 2: Insert sample records
INSERT INTO sales_orders
(order_id, order_date, region, revenue, status)
VALUES
(1, '2026-10-01', 'North', 1200.00, 'completed'),
(2, '2026-10-01', 'South', 900.00, 'completed'),
(3, '2026-10-02', 'North', 1500.00, 'completed'),
(4, '2026-10-02', 'South', 650.00, 'completed'),
(5, '2026-10-03', 'North', 800.00, 'completed'),
(6, '2026-10-03', 'South', 400.00, 'completed');
We now have a small dataset with two regions and three days of sales.
Step 3: Ask your AI coding agent to inspect the schema
Try this prompt in your configured coding agent:
Inspect the accessible Amazon Redshift database and identify the tables and columns relevant to sales reporting. Explain which columns contain the order date, region, revenue, and status. Do not modify any data.
This is a useful starting point because the agent can work with actual database metadata rather than relying entirely on assumptions.
Step 4: Generate a daily revenue report
Next, ask:
Write a Redshift SQL query to calculate completed revenue by day and region. Exclude non-completed orders and sort the output by date and region. Explain the query before execution.
A suitable query is:
SELECT
order_date,
region,
SUM(revenue) AS total_revenue
FROM sales_orders
WHERE status = 'completed'
GROUP BY
order_date,
region
ORDER BY
order_date,
region;
Expected observations:
- North revenue on October 1: $1,200
- North revenue on October 2: $1,500
- North revenue on October 3: $800
- South revenue on October 1: $900
- South revenue on October 2: $650
- South revenue on October 3: $400
These values are based on the sample records above. The report makes daily changes visible without manually calculating totals.
Step 5: Find the percentage change
Now ask the agent:
Compare daily completed revenue for each region. Calculate the percentage change from the previous available date, and explain any limitations in the analysis. Generate a read-only query first.
Here is one way to implement that analysis:
WITH daily_revenue AS (
SELECT
order_date,
region,
SUM(revenue) AS revenue
FROM sales_orders
WHERE status = 'completed'
GROUP BY
order_date,
region
),
revenue_comparison AS (
SELECT
order_date,
region,
revenue,
LAG(revenue) OVER (
PARTITION BY region
ORDER BY order_date
) AS previous_revenue
FROM daily_revenue
)
SELECT
order_date,
region,
revenue,
previous_revenue,
ROUND(
100.0 * (revenue - previous_revenue)
/ NULLIF(previous_revenue, 0),
2
) AS percentage_change
FROM revenue_comparison
ORDER BY
region,
order_date;
The LAG() window function retrieves the previous available revenue value for the same region. NULLIF() prevents division by zero.
This helps identify when revenue decreased. It does not establish the underlying cause. To investigate further, you might need order volumes, refunds, product categories, inventory data, or application logs.
Troubleshooting Redshift with AI
AI coding agents can also help review queries and explain possible performance problems.
Try this prompt:
Review this Redshift query for correctness and performance. Identify potentially inefficient joins, unnecessary scans, filtering problems, and opportunities to improve the query. Explain each recommendation and do not execute changes.
Depending on the available tools and information, an agent can help you investigate:
- SQL syntax and incorrect joins.
- Filters that change the meaning of a report.
- Table distribution and sort-key choices.
- Repeated analytical queries that may benefit from materialized views.
- Query plans and relevant performance metadata.
For meaningful performance tuning, provide actual query plans and workload evidence. Test the proposed query against representative data and verify that the output remains correct.
Setting up Agent Toolkit for AWS
Use the current official documentation to configure the toolkit and your preferred coding agent.
Quick start: https://docs.aws.amazon.com/agent-toolkit/latest/userguide/quick-start.html
The documented setup flow includes configuring your AWS environment and installing the integrations appropriate to your editor. A documented CLI setup command is:
aws configure agent-toolkit
Verify the required AWS CLI version and current setup instructions before running it.
For editor-specific steps, see the AWS Builder Center setup guide for Kiro, Claude Code, and Cursor.
Installing an integration does not automatically grant database access. Your AWS identity, Redshift configuration, and database permissions must be set up appropriately.
Security practices you should follow
Connecting an AI coding agent to a database requires careful permission management.
- Start with read-only access. Allow only the metadata inspection and queries needed for the task.
- Review SQL before execution. Check filters, joins, aggregation, and data scope.
- Require approval for mutations. Treat data changes, schema changes, and permission changes as higher-risk operations.
- Protect sensitive data. Avoid exposing credentials or unnecessary confidential records in prompts.
- Apply least privilege. Configure AWS IAM and database-level permissions appropriately.
- Audit activity. Use available AWS and database logging to investigate access and execution.
- Verify every result. Compare agent-generated reports with trusted queries and known totals.
The goal is to make database development more productive while keeping humans accountable for important decisions.
What should you measure?
If you're introducing agent-assisted workflows to your team, measure the impact rather than assuming it will be positive.
Useful metrics include:
- Time to create a report.
- Time to diagnose a query error.
- Percentage of generated queries accepted after review.
- Query execution time before and after optimization.
- Accuracy against an established reporting baseline.
- Unsafe operations prevented through approval controls.
Conclusion
Amazon Redshift and Agent Toolkit for AWS create new opportunities for AI-assisted data engineering.
Developers using Claude Code, Kiro, and Cursor can explore schemas, generate analytical SQL, investigate data patterns, and review troubleshooting recommendations through a more conversational workflow.
Start with a small read-only project, validate every query, and introduce broader capabilities only after you have reliable security and review processes.
Useful resources
- Amazon Redshift Agent Toolkit announcement
- Agent Toolkit for AWS documentation
- Agent Toolkit quick start
- Query Amazon Redshift using natural language with Kiro

Top comments (0)