Guide · Amazon Redshift Serverless · MCP Server Tools · Data Warehousing
Amazon Redshift Serverless for MCP Servers — Namespaces, Workgroups, RPU Config, IAM Auth
Redshift Serverless removes cluster management from the equation: you create a namespace (storage) and a workgroup (compute), set a base RPU capacity, and query. No instance types, no manual resizing, no VPN-routed JDBC connections. For MCP server tools, Serverless is appealing because it scales to zero between agent sessions — you pay for queries, not idle clusters. But Serverless has a cold-start latency of 15–60 seconds on the first query after an idle period, which matters a great deal for MCP tools where the calling agent expects a response within a few seconds. This guide covers the namespace/workgroup architecture, RPU configuration, IAM database authentication via the Data API, VPC endpoint setup for private access, cold start mitigation, snapshot policy, cost monitoring, and the specific API calls needed to provision and manage Serverless resources programmatically.
TL;DR
A Redshift Serverless deployment has two objects: a namespace (database storage, users, snapshots) and a workgroup (compute endpoint, RPU range, VPC config). Connect MCP tools via the Redshift Data API using the workgroup name instead of a cluster identifier. Set WorkgroupName in ExecuteStatementCommand; omit ClusterIdentifier. Base RPU starts at 8 and scales automatically; set BaseCapacity between 8–512 in multiples of 8. Cold starts take 15–60 seconds — for latency-sensitive MCP tools, run a lightweight warm-up query on a 5-minute schedule via EventBridge. Monitor cost via GetComputeCapacityCommand and tag workgroups with billing:project for attribution.
Namespace vs workgroup — what each object owns
Redshift Serverless separates storage from compute into two distinct objects. Understanding which configuration belongs where is the first step to managing Serverless programmatically.
| Concept | Namespace | Workgroup |
|---|---|---|
| Contains | Database storage, users, schemas, snapshots, parameter groups | Compute endpoint, RPU configuration, VPC subnets, security groups, enhanced VPC routing |
| DNS endpoint | No query endpoint | <workgroup>.<account>.<region>.redshift-serverless.amazonaws.com:5439 |
| Data API field | Not used for queries | WorkgroupName in Data API calls |
| Billing unit | Storage (GB-month) | Compute (RPU-hours during active query time) |
| Snapshot policy | Automated snapshots, cross-region copy targets | Not applicable |
| Admin user | Namespace admin username + password or IAM-only | Not applicable |
A namespace can be associated with multiple workgroups in different regions (for read replicas), but each workgroup points to exactly one namespace. For most MCP server deployments, you have one namespace and one workgroup per environment.
Creating Serverless resources via the AWS SDK
The Redshift Serverless SDK client is @aws-sdk/client-redshift-serverless — a separate package from the provisioned cluster client @aws-sdk/client-redshift. Import accordingly:
import {
RedshiftServerlessClient,
CreateNamespaceCommand,
CreateWorkgroupCommand,
GetWorkgroupCommand,
GetNamespaceCommand,
GetComputeCapacityCommand,
ListWorkgroupsCommand,
} from "@aws-sdk/client-redshift-serverless";
const rsServerless = new RedshiftServerlessClient({ region: "us-east-1" });
// Create namespace (storage layer)
await rsServerless.send(new CreateNamespaceCommand({
namespaceName: "analytics-ns",
adminUsername: "admin",
adminUserPassword: await getSecret("redshift/admin-password"),
dbName: "analytics",
defaultIamRoleArn: "arn:aws:iam::123456789012:role/RedshiftS3ReadRole",
iamRoles: ["arn:aws:iam::123456789012:role/RedshiftS3ReadRole"],
tags: [{ key: "billing:project", value: "analytics-mcp" }],
}));
// Create workgroup (compute layer) — links to namespace
await rsServerless.send(new CreateWorkgroupCommand({
workgroupName: "analytics-wg",
namespaceName: "analytics-ns",
baseCapacity: 8, // 8 RPU minimum; scales up to maxCapacity automatically
maxCapacity: 64, // optional ceiling; prevents runaway cost on bad queries
enhancedVpcRouting: true, // route S3 traffic through VPC, not public internet
subnetIds: ["subnet-aaa", "subnet-bbb"],
securityGroupIds: ["sg-redshift"],
publiclyAccessible: false,
tags: [{ key: "billing:project", value: "analytics-mcp" }],
}))
Both CreateNamespaceCommand and CreateWorkgroupCommand are asynchronous — the resources move through a CREATING state before becoming AVAILABLE. Poll with GetWorkgroupCommand until workgroup.status === "AVAILABLE" before attempting queries.
async function waitForWorkgroup(name: string): Promise<void> {
for (let i = 0; i < 30; i++) {
const { workgroup } = await rsServerless.send(new GetWorkgroupCommand({
workgroupName: name,
}));
if (workgroup?.status === "AVAILABLE") return;
await new Promise(r => setTimeout(r, 10_000));
}
throw new Error("Workgroup did not become AVAILABLE within 5 minutes");
}
Connecting MCP tools to Redshift Serverless via the Data API
The Redshift Data API works identically for Serverless and provisioned clusters, with one key difference: use WorkgroupName instead of ClusterIdentifier. Never set both in the same call — the API will reject it.
import {
RedshiftDataClient,
ExecuteStatementCommand,
DescribeStatementCommand,
GetStatementResultCommand,
StatusString,
} from "@aws-sdk/client-redshift-data";
const rsData = new RedshiftDataClient({ region: "us-east-1" });
async function queryServerless(sql: string, params: { name: string; value: string }[] = []) {
const { Id: statementId } = await rsData.send(new ExecuteStatementCommand({
WorkgroupName: "analytics-wg", // <-- Serverless: WorkgroupName, not ClusterIdentifier
Database: "analytics",
// No DbUser needed for Serverless with IAM auth — omit it entirely
Sql: sql,
Parameters: params,
WithEvent: false,
}));
// Poll until terminal state
for (let i = 0; i < 60; i++) {
const { Status, Error: err } = await rsData.send(new DescribeStatementCommand({
Id: statementId!,
}));
if (Status === StatusString.FINISHED) break;
if (Status === StatusString.FAILED || Status === StatusString.ABORTED) {
throw new Error(`Query failed: ${err}`);
}
// Cold start: first query after idle period can take 15-60 seconds to reach STARTED
await new Promise(r => setTimeout(r, 2_000));
}
return statementId!;
}
Notice there is no DbUser field in the Serverless call. For provisioned clusters, DbUser specifies the database user to run as when using temporary credentials. For Serverless, the IAM principal calling ExecuteStatementCommand is the authenticated user — Redshift Serverless creates a database user automatically on first access, named after the IAM entity (e.g., IAMR:MyLambdaRole). Grant this user appropriate permissions in the database after the first successful connection.
IAM permissions for Redshift Serverless Data API
The IAM policy for Serverless Data API calls differs from provisioned clusters. There is no redshift:GetClusterCredentials requirement for Serverless — authentication is entirely IAM-based. The minimum policy for an MCP server Lambda that only reads data:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"redshift-data:ExecuteStatement",
"redshift-data:DescribeStatement",
"redshift-data:GetStatementResult",
"redshift-data:ListStatements",
"redshift-data:CancelStatement"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"redshift-serverless:GetWorkgroup",
"redshift-serverless:GetCredentials"
],
"Resource": "arn:aws:redshift-serverless:us-east-1:123456789012:workgroup/*"
}
]
}
The redshift-serverless:GetCredentials action is called internally by the Data API service to obtain a temporary database token when it processes your ExecuteStatementCommand. Without this permission, the Data API call returns an AccessDeniedException with a message about credentials retrieval — an easy gotcha because the error doesn't directly indicate that the missing permission is on the serverless side.
For write operations (INSERT, UPDATE, DELETE, DDL), also add redshift-data:ExecuteStatement on the specific workgroup ARN and ensure the auto-created IAM database user has the appropriate GRANT statements in Redshift. Run these once after first access:
-- Grant read-only access to the auto-created IAM role user
GRANT USAGE ON SCHEMA analytics TO "IAMR:MyMcpServerRole";
GRANT SELECT ON ALL TABLES IN SCHEMA analytics TO "IAMR:MyMcpServerRole";
ALTER DEFAULT PRIVILEGES IN SCHEMA analytics GRANT SELECT ON TABLES TO "IAMR:MyMcpServerRole";
Cold start latency — the critical issue for MCP tools
Redshift Serverless scales to zero when idle for approximately 30 minutes. After that idle period, the first query encounters a cold start: Serverless allocates compute capacity, initializes the query engine, and loads relevant catalog metadata. This takes 15–60 seconds before the query begins executing, and the DescribeStatementCommand will show the statement in STARTED state during this warm-up. The query itself executes normally after warm-up — cold start only affects the first statement.
For MCP server tools where an AI agent is waiting for a response, 60 seconds of cold start latency is unacceptable. Three mitigation strategies:
| Strategy | Mechanism | Cost | Effectiveness |
|---|---|---|---|
| EventBridge keep-warm | Schedule a lightweight SELECT 1 every 5 minutes via EventBridge Scheduler → Lambda | Minimal — a 1-second query at 8 RPU every 5 minutes | Prevents idle, keeps workgroup warm |
| Increase base RPU | Higher base RPU reduces cold start duration (more capacity pre-allocated) | Higher minimum compute cost even when idle | Partial — still cold starts after 30 min idle |
| Provisioned cluster | No cold starts at all; cluster always available | Continuous cluster cost even at zero load | Complete — but negates Serverless benefit |
The EventBridge keep-warm approach is the best tradeoff for most MCP server deployments. A SELECT 1 query costs negligible RPU-seconds and prevents the 30-minute idle timeout from being hit during active working hours:
// Keep-warm Lambda: runs on a 5-minute EventBridge schedule
export const handler = async () => {
const { Id } = await rsData.send(new ExecuteStatementCommand({
WorkgroupName: "analytics-wg",
Database: "analytics",
Sql: "SELECT 1",
}));
// Don't poll for result — fire-and-forget is fine for a keep-warm ping
return { statementId: Id };
};
If your MCP server is used only during business hours, scope the EventBridge schedule to those hours to avoid overnight charges. EventBridge Scheduler supports cron expressions with time-of-day constraints.
RPU configuration and auto-scaling
Redshift Processing Units (RPU) are the billing unit for Serverless compute. BaseCapacity is the minimum RPU allocation — the workgroup never drops below this floor. MaxCapacity is an optional ceiling introduced in 2024 to prevent cost spikes from unexpectedly expensive queries.
| Base RPU | Approximate monthly cost (8h/day idle, 1h/day querying) | Suitable for |
|---|---|---|
| 8 RPU (minimum) | ~$10–20/month | Dev/test, infrequent analytics MCP tools |
| 32 RPU | ~$40–80/month | Production tools with moderate query concurrency |
| 128 RPU | ~$150–300/month | High-concurrency MCP tools, complex analytical queries |
| 512 RPU (maximum) | ~$500–1000/month | Enterprise data warehouse workloads |
Redshift Serverless auto-scales between BaseCapacity and MaxCapacity based on query queue depth and parallelism. It scales up quickly (seconds) and scales down more slowly (minutes) to avoid thrashing. Auto-scaling is transparent to your MCP tools — you always use the same workgroup name regardless of current RPU allocation.
Update RPU configuration at runtime without downtime using UpdateWorkgroupCommand:
import { UpdateWorkgroupCommand } from "@aws-sdk/client-redshift-serverless";
// Scale down during off-hours (triggered by EventBridge Scheduler)
await rsServerless.send(new UpdateWorkgroupCommand({
workgroupName: "analytics-wg",
baseCapacity: 8, // drop to minimum outside business hours
}));
// Scale up before business hours
await rsServerless.send(new UpdateWorkgroupCommand({
workgroupName: "analytics-wg",
baseCapacity: 32, // increase for daytime load
}));
VPC and network configuration
Redshift Serverless workgroups must be associated with VPC subnets and security groups at creation time. Unlike provisioned clusters, you cannot change VPC configuration after creation without deleting and recreating the workgroup. Plan VPC placement carefully before first deploy.
Key networking rules for MCP server deployments:
- Enhanced VPC routing: Enable
enhancedVpcRouting: trueto force COPY/UNLOAD S3 traffic through VPC routes rather than the public internet. Required for private VPC deployments and reduces data transfer costs. - Security group: The workgroup security group must allow inbound TCP 5439 from Lambda security groups (for JDBC connections) and outbound to Redshift Data API endpoints. For Data API-only access, inbound rules are not strictly required since the Data API calls the workgroup on your behalf.
- Subnet selection: Place workgroups in private subnets. At least 3 subnets across 3 AZs are required; Serverless uses all specified subnets for HA.
- VPC endpoint for Data API: For fully private access (no internet gateway required), create a VPC Interface Endpoint for
redshift-data:com.amazonaws.us-east-1.redshift-data. This routes all Data API calls through private IP addresses within your VPC.
# Create VPC endpoint for private Redshift Data API access
aws ec2 create-vpc-endpoint \
--vpc-id vpc-abc123 \
--service-name com.amazonaws.us-east-1.redshift-data \
--vpc-endpoint-type Interface \
--subnet-ids subnet-aaa subnet-bbb subnet-ccc \
--security-group-ids sg-vpce \
--private-dns-enabled
Cost monitoring with GetComputeCapacityCommand
Monitor actual compute consumption — not just what you configured — using GetComputeCapacityCommand. This shows the current allocated RPU and helps distinguish between idle time (at base RPU) and active query time (auto-scaled up):
import { GetComputeCapacityCommand } from "@aws-sdk/client-redshift-serverless";
const { capacities } = await rsServerless.send(new GetComputeCapacityCommand({
workgroupName: "analytics-wg",
period: "daily", // "hourly" | "daily" | "weekly"
startTime: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
endTime: new Date(),
}));
// capacities is an array of { timestamp, numUnits } data points
const totalRpuHours = capacities?.reduce((acc, c) => acc + (c.numUnits ?? 0), 0);
console.log(`Estimated compute last 7 days: ${totalRpuHours} RPU-hours`);
For cost attribution across multiple MCP tools sharing a workgroup, use Redshift query tagging via query_group session parameter. Set the query group before executing your statement:
// Tag queries by MCP tool name for cost attribution
await rsData.send(new ExecuteStatementCommand({
WorkgroupName: "analytics-wg",
Database: "analytics",
Sql: `SET query_group TO 'mcp-tool-sales-report'; ${actualQuery}`,
}));
Query groups appear in the Redshift query monitoring views (SYS_QUERY_HISTORY, SYS_QUERY_DETAIL) and in CloudWatch Logs if you enable audit logging on the namespace. This gives per-tool query cost breakdown without separate workgroups per tool.
Snapshots and backup policy
Redshift Serverless takes automated snapshots of the namespace at configurable intervals. Configure snapshot retention on the namespace, not the workgroup:
import { UpdateSnapshotScheduleCommand } from "@aws-sdk/client-redshift-serverless";
await rsServerless.send(new UpdateSnapshotScheduleCommand({
namespaceName: "analytics-ns",
scheduleDefinitions: [
{ scheduledTime: undefined, cron: "0 2 * * *" }, // daily at 2am UTC
],
retentionPeriod: 14, // days; max 35 for automated snapshots
}));
Snapshots are stored in S3 at no additional charge beyond the storage cost. Cross-region snapshot copies for disaster recovery require explicit configuration:
import { UpdateSnapshotCopyConfigurationCommand } from "@aws-sdk/client-redshift-serverless";
await rsServerless.send(new UpdateSnapshotCopyConfigurationCommand({
snapshotCopyConfigurationId: "config-id-from-create",
snapshotRetentionPeriod: 7, // days to retain in destination region
}));
Common errors and fixes
| Error | Cause | Fix |
|---|---|---|
AccessDeniedException on ExecuteStatement | Missing redshift-serverless:GetCredentials in IAM policy | Add redshift-serverless:GetCredentials to the caller's IAM policy |
Query stuck in STARTED for 60+ seconds | Cold start — workgroup warming up after idle period | Implement 5-minute keep-warm ping via EventBridge Scheduler |
ValidationException: cannot specify both ClusterIdentifier and WorkgroupName | Using provisioned cluster client call signature for Serverless | Remove ClusterIdentifier; use only WorkgroupName for Serverless |
| Database user has no permissions after first login | Auto-created IAM user IAMR:RoleName has no GRANT | Connect as admin and run GRANT USAGE ON SCHEMA + GRANT SELECT ON TABLES |
InsufficientCapacityException | Query requires more RPU than MaxCapacity allows | Increase MaxCapacity or rewrite query to reduce resource consumption |
| COPY command fails with S3 access error despite valid IAM role | enhancedVpcRouting: true routes S3 traffic through VPC, but no route table entry for S3 | Add an S3 VPC Gateway Endpoint to the workgroup's route table |
Related guides
- Amazon Redshift for MCP servers: Data API basics, IAM auth, async execution
- Redshift Data API result pagination: NextToken, large result sets, column metadata
- Redshift Spectrum for MCP tools: query S3 data lakes with external tables
- Redshift COPY command for MCP tools: bulk-load S3 data into Redshift tables
- MCP server uptime monitoring