Enterprise Claude Apps Gateway: Deploying Agents on AWS & GCP
As AI coding tools transition from individual developer utility to organization-wide engineering infrastructure, enterprise security teams face strict compliance mandates: centralizing API credentials, enforcing Single Sign-On (SSO) identity authentication, auditing prompt payloads, controlling data retention, and capping token spend per engineering group. Rather than pointing developers directly at external public API endpoints, enterprise deployments route all Claude Code and Agent SDK traffic through a self-hosted Claude Apps Gateway.
This article provides an end-to-end architectural blueprint for self-hosting the Claude Apps Gateway on AWS (ECS Fargate / EKS) and Google Cloud (Cloud Run / GKE). We walk through a real enterprise setup at a financial service company — configuring OIDC SSO authentication, routing requests to Amazon Bedrock and Google Cloud Agent Platform, enforcing live per-developer spend limits, and exporting OpenTelemetry (OTel) audit logs. For complementary client harness details, see How Claude Code Works and Claude Agent SDK Guide.
Self-Hosted Gateway Topology & Upstream Routing
The Claude Apps Gateway operates as a reverse proxy positioned between client interfaces (Claude Code CLI, Desktop, VS Code extensions, or custom Agent SDK microservices) and upstream cloud model providers (Amazon Bedrock, Google Cloud Agent Platform, or the Anthropic API).
By routing all developer traffic through the gateway, security teams gain a single point of enforcement for authentication, model access rules, TLS termination, and telemetry logging.
| Feature | Direct API Connection | Self-Hosted Claude Apps Gateway |
|---|---|---|
| Credential Handling | API keys stored on developer laptops | Centralized IAM roles (No keys on endpoints) |
| Identity & Auth | Individual user logins / static keys | Enterprise OIDC SSO (Okta, Azure AD, Ping) |
| Spend Control | Post-hoc bill inspection in cloud console | Live per-user & per-team daily spend caps |
| Network Boundary | Public internet endpoint calls | VPC endpoints, proxying, and mTLS support |
Quick reference
- Developers authenticate with the gateway using their corporate IdP (OIDC).
- The gateway assumes cloud IAM roles (AWS IAM / GCP Service Accounts) to invoke upstream models.
- Zero API keys reside on developer workstations.
Remember this
The Claude Apps Gateway centralizes credential management, identity authentication, and cost controls into a single manageable proxy layer.
Configuring gateway.yaml for Enterprise Routing
The core configuration file gateway.yaml controls proxy listeners, TLS settings, OIDC identity provider integration, PostgreSQL state storage, and upstream cloud model routing.
Below is a production gateway.yaml configuration:
1version: "1.0"2server:3 listen: "0.0.0.0:8443"4 tls:5 certFile: "/etc/gateway/certs/tls.crt"6 keyFile: "/etc/gateway/certs/tls.key"7 8auth:9 oidc:10 issuer: "https://auth.company.com/oauth2/default"11 clientId: "claude-gateway-app"12 allowedGroups: ["Engineering", "DataScience"]13 14store:15 postgres:16 connectionString: "postgresql://gateway_admin@db.internal:5432/claude_gateway"17 18upstreams:19 bedrock:20 provider: "aws-bedrock"21 region: "us-east-1"22 roleArn: "arn:aws:iam::123456789012:role/ClaudeGatewayBedrockRole"23 24 agentPlatform:25 provider: "gcp-agent-platform"26 region: "us-central1"27 serviceAccount: "claude-gateway@project.iam.gserviceaccount.com"28 29routing:30 defaultUpstream: "bedrock"31 modelAliases:32 sonnet: "anthropic.claude-3-7-sonnet-20250219-v1:0"33 opus: "anthropic.claude-3-opus-20240229-v1:0"Quick reference
- OIDC integration validates incoming JWT tokens against corporate IdP group claims.
- Postgres stores active developer session states, token spend tracking, and rate-limit counters.
- Model aliases insulate client applications from underlying cloud-specific ARN / model ID formats.
Remember this
A declarative gateway.yaml decouples upstream cloud providers from client-side CLI configurations.
Cloud Deployment Blueprints: AWS (ECS Fargate) & GCP (Cloud Run)
To ensure high availability and automatic scaling, the gateway container should be deployed using managed container platforms with auto-scaling capabilities.
- AWS Deployment (ECS Fargate): Deploy behind an Application Load Balancer (ALB) inside a private VPC. Route container traffic through AWS VPC Endpoints (PrivateLink) to Amazon Bedrock, eliminating internet traversal. Use AWS Secrets Manager for database credentials. - GCP Deployment (Cloud Run): Deploy as an autoscaling Cloud Run service connected to a Cloud SQL PostgreSQL instance via Cloud SQL Auth Proxy. Authenticate to Google Cloud's Agent Platform using Workload Identity.
Quick reference
- ECS Fargate containers scale dynamically based on active HTTP concurrency metrics.
- VPC endpoints ensure that prompt payloads remain within your cloud security perimeter.
- Cloud Run instances autoscale to zero when idle, minimizing base infrastructure costs.
Remember this
Deploying on managed cloud container services guarantees high availability, private VPC networking, and effort-free auto-scaling.
Per-Developer Spend Limits & OTel Audit Logging
Uncapped access to high-capability models can lead to budget overruns. The Claude Apps Gateway enforces Live Spend Limits per user, team, or department. Limits can be configured per day, week, or month via an Admin API.
When a developer's accumulated usage reaches their limit, the gateway intercepts incoming calls and returns a 429 Spend Limit Exceeded error before any upstream request is made.
1# Set a $25.00 daily spend cap for user dev_user_882curl -X POST https://gateway.internal/admin/v1/spend-limits \3 -H "Authorization: Bearer $ADMIN_KEY" \4 -H "Content-Type: application/json" \5 -d '{6 "userId": "dev_user_88",7 "period": "daily",8 "limitUsd": 25.009 }'Quick reference
- OpenTelemetry (OTel) exporters stream detailed trace data to Datadog, Splunk, or CloudWatch.
- Attribution headers attach user ID, department, and repository metadata to every span.
- Spend caps are enforced instantaneously across all client processes connected to the gateway cluster.
Remember this
Live spend limits and OTel telemetry give engineering leadership complete cost control and auditability.
Hands-on Practice: Deploy & Test a Local Gateway Container
Practice configuring the Claude Apps Gateway locally with this exercise:
1. Build Container: Clone the gateway repository and build the container image docker build -t claude-gateway ..
2. Configure Local YAML: Create a minimal gateway.yaml pointing to a local PostgreSQL container.
3. Launch & Verify: Start the container and run curl http://localhost:8080/health to confirm healthy status 200 OK.
4. Client Test: Point Claude Code CLI at your local gateway by setting export CLAUDE_BASE_URL=http://localhost:8080 and execute a test prompt.
Quick reference
- Confirm that the client CLI logs display your custom gateway endpoint URL during initialization.
- Check that container stdout logs display incoming token attribution headers for your test request.
- Verify that PostgreSQL records a new session entry matching your test CLI session ID.
Remember this
Testing a local gateway container validates configuration options before committing changes to production cloud pipelines.
Key takeaway
Self-hosting the Claude Apps Gateway on AWS or Google Cloud equips enterprise security and platform teams with the control required for organization-wide AI adoption. By pairing OIDC Single Sign-On, centralized IAM credential management, VPC PrivateLink networking, live per-developer spend limits, and OpenTelemetry audit logs, companies can scale Claude Code and Agent SDK deployments while maintaining complete security, privacy, and budget compliance.
Practice (20 min): Build and run a local gateway container using Docker and a minimal gateway.yaml. Configure your local CLI via export CLAUDE_BASE_URL=http://localhost:8080, submit a test prompt, and confirm in container logs that authentication and upstream routing execute cleanly.
Related Articles
Explore this topic