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.

ConceptNamespaceWorkgroup
ContainsDatabase storage, users, schemas, snapshots, parameter groupsCompute endpoint, RPU configuration, VPC subnets, security groups, enhanced VPC routing
DNS endpointNo query endpoint<workgroup>.<account>.<region>.redshift-serverless.amazonaws.com:5439
Data API fieldNot used for queriesWorkgroupName in Data API calls
Billing unitStorage (GB-month)Compute (RPU-hours during active query time)
Snapshot policyAutomated snapshots, cross-region copy targetsNot applicable
Admin userNamespace admin username + password or IAM-onlyNot 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:

StrategyMechanismCostEffectiveness
EventBridge keep-warmSchedule a lightweight SELECT 1 every 5 minutes via EventBridge Scheduler → LambdaMinimal — a 1-second query at 8 RPU every 5 minutesPrevents idle, keeps workgroup warm
Increase base RPUHigher base RPU reduces cold start duration (more capacity pre-allocated)Higher minimum compute cost even when idlePartial — still cold starts after 30 min idle
Provisioned clusterNo cold starts at all; cluster always availableContinuous cluster cost even at zero loadComplete — 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 RPUApproximate monthly cost (8h/day idle, 1h/day querying)Suitable for
8 RPU (minimum)~$10–20/monthDev/test, infrequent analytics MCP tools
32 RPU~$40–80/monthProduction tools with moderate query concurrency
128 RPU~$150–300/monthHigh-concurrency MCP tools, complex analytical queries
512 RPU (maximum)~$500–1000/monthEnterprise 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:

# 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

ErrorCauseFix
AccessDeniedException on ExecuteStatementMissing redshift-serverless:GetCredentials in IAM policyAdd redshift-serverless:GetCredentials to the caller's IAM policy
Query stuck in STARTED for 60+ secondsCold start — workgroup warming up after idle periodImplement 5-minute keep-warm ping via EventBridge Scheduler
ValidationException: cannot specify both ClusterIdentifier and WorkgroupNameUsing provisioned cluster client call signature for ServerlessRemove ClusterIdentifier; use only WorkgroupName for Serverless
Database user has no permissions after first loginAuto-created IAM user IAMR:RoleName has no GRANTConnect as admin and run GRANT USAGE ON SCHEMA + GRANT SELECT ON TABLES
InsufficientCapacityExceptionQuery requires more RPU than MaxCapacity allowsIncrease MaxCapacity or rewrite query to reduce resource consumption
COPY command fails with S3 access error despite valid IAM roleenhancedVpcRouting: true routes S3 traffic through VPC, but no route table entry for S3Add an S3 VPC Gateway Endpoint to the workgroup's route table

Related guides