Claude apps gateway on AWS: Okta SSO, Piece by Piece
Give Claude Code on Amazon Bedrock a single control point: a hand-built walkthrough of the Claude apps gateway with an Okta SSO deep dive
Community content, not official AWS or Anthropic documentation. The Claude apps gateway is Anthropic software that ships inside the Claude Code CLI; this article is my own hands-on reconstruction for AWS, verified against the AWS announcement and Anthropic's gateway docs . Always confirm commands against the current docs, the gateway is evolving. Licensed CC BY-SA 4.0.
Introduction
Organizations roll out Claude Code on Amazon Bedrock for its security posture: inference stays inside the AWS network. That posture holds at the network layer. On the laptops, every developer sets
CLAUDE_CODE_USE_BEDROCK=1 and signs requests with their own AWS credential, managed settings are pushed to each machine by hand, and spend scatters across a dozen accounts. Sooner or later, finance wants to know who is spending what, and security wants to know why long-lived Bedrock credentials are sitting on two hundred laptops. You have no clean answer, because there is no single control point.That is the problem the Claude apps gateway solves. It is a self-hosted control plane that puts identity, policy, and cost for Claude Code onto one enforcement point instead of spreading credentials and settings across every developer machine.
AWS announced the gateway in July 2026 in Introducing Claude apps gateway for AWS , and the AWS team publishes a deployable AWS CDK sample with a setup script and field notes . If you want one-command infrastructure, start there. This article is the companion for builders who'd rather understand every piece as they build it by hand — each AWS resource, each
gateway.yaml decision, and a deeper treatment of the Okta integration than the sample covers and I'll be opinionated about the choices that matter.My take up front: stand this up the moment you have more than a handful of Claude Code users, the alternative is credential sprawl you can't audit. And on AWS, two decisions will save or cost you an afternoon each: pin the internal ALB to IPv4, and settle your TLS trust story before you deploy anything. Both are covered in Steps 6–7, both are the traps I hit first. The IPv4 trap is independently marked verified live in the AWS sample's field notes (linked under References), which document the cert-pinning behavior too and are worth reading in full.
You will deploy the gateway on Amazon ECS with AWS Fargate, front it with an internal Application Load Balancer, back it with Amazon RDS for PostgreSQL, connect developer sign-in to Okta over OIDC, and route inference to Amazon Bedrock.
What you will learn
- When to use AWS's one-command CDK sample and when to build by hand, and what the hand-built path teaches you about each piece
- How to run the Claude apps gateway as a stateless container on ECS Fargate behind an internal ALB
- How to federate developer sign-in directly to Okta over OIDC (with no IAM Identity Center in the path), and when to use Okta's org vs. custom authorization server
- How to give the gateway least-privilege access to Amazon Bedrock with an IAM task role
- How to avoid the two AWS traps this deployment hits (dual-stack ALB public IPv6, and TLS certificate trust), plus an EC2-only IMDS credential trap that Fargate sidesteps
- How to verify the deployment and roll it out to developers via managed settings (MDM)
Solution overview
The gateway is delivered by Anthropic inside the same
claude CLI binary your developers already use, so there is no separate product to install. You run it as one stateless container in your VPC. It does five things: identity (OIDC SSO), policy (managed settings by Okta group), telemetry (per-user OTLP usage), routing (to your model provider), and spend caps.This guide routes to Amazon Bedrock, but the gateway can route to any of five upstreams: Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform, Microsoft Foundry, or the Anthropic API — with cross-Region and cross-account failover.
Scope. The gateway governs every Claude Code invocation on a signed-in machine, including non-interactive
claude -p runs and Agent SDK sessions. It does not cover Claude Code on the web or mobile (those are Claude Enterprise features) and CI/CD pipelines cannot authenticate through it (sign-in requires browser SSO; AWS's sample FAQ confirms this and recommends configuring CI against Amazon Bedrock directly with IAM credentials).Anthropic's technical documentation centers the gateway on Claude Code; the same sample FAQ additionally states that Claude Desktop (including Chat and Cowork) can route through the gateway when its URL is configured via MDM managed settings. This guide covers the Claude Code path; verify Desktop behavior against the current documentation before relying on it. Two developer-experience limits worth knowing up front (from the sample's known-limitations list): server-side web search is disabled through the gateway, and 1-hour prompt caching is unavailable (5-minute only).
The gateway has two independent authentication planes:
- Developer → gateway: the gateway is itself an OIDC relying party that federates directly with Okta. Developers sign in through a browser SSO flow and receive a short-lived token (1 hour by default). No AWS IAM Identity Center is involved in this path.
- Gateway → Amazon Bedrock: the gateway uses its own IAM role (the ECS task role) to call Bedrock via SigV4 on the developer's behalf. The end user never presents an AWS credential to Bedrock.
So Okta governs who may use the gateway, and one IAM role governs the gateway's access to Bedrock.
What each service does:
- Amazon ECS on Fargate: runs the stateless gateway container (no servers to manage).
- Amazon ECR: stores your gateway image.
- Amazon RDS for PostgreSQL: holds short-lived sign-in state and rate-limit counters (and spend counters if you enable caps).
- AWS Secrets Manager: holds the three real secrets (JWT signing key, Okta client secret, Postgres URL).
- IAM task role: grants the gateway
bedrock:InvokeModel/bedrock:InvokeModelWithResponseStream.
- Internal ALB + AWS Certificate Manager: private HTTPS entry point for developers.
- Okta: the OIDC identity provider for developer sign-in.
Prerequisites
- An AWS account with permission to create ECS/Fargate, ECR, RDS, IAM, Secrets Manager, ACM, VPC, and ALB resources.
- AWS CLI v2 and Docker installed locally.
- Amazon Bedrock model access granted for the Claude models you need, in each Region you'll route to.
- An Okta org where you can create an OIDC app integration.
- A VPC with private subnets for the gateway task and RDS, and a private path for developers to reach the ALB (VPN, AWS Direct Connect, or peered corporate network).
- A private TLS hostname for the gateway and a certificate for it (see the note on ACM vs AWS Private CA in Step 6).
- Claude Code CLI v2.1.195 or later (the gateway server binary is downloaded separately in Step 4; your local CLI is for client-side testing, and both must be ≥ 2.1.195).
Confirm your tooling:
aws --version # aws-cli/2.xdocker --version # Docker version 2x.xclaude --version # 2.1.195 or laterExpected output (versions will vary, but all three must resolve):
aws-cli/2.31.9 Python/3.13.4 Darwin/24.5.0 source/arm64Docker version 28.6.0, build abc12342.1.195 (Claude Code)Set a few shared variables:
export AWS_REGION=us-east-1export ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)export GATEWAY_HOST=claude-gateway.cc-gw.internal # your private DNS nameStep 1: Register an OIDC app in Okta
In the Okta Admin Console → Applications → Applications → Create App Integration → OIDC - OpenID Connect → Web Application:
- Set the Sign-in redirect URIs field to
https://<GATEWAY_HOST>/oauth/callback.
- Set Grant type to Authorization Code (the gateway uses PKCE by default, which Okta supports).
- Record the Client ID and Client secret (the secret becomes
OIDC_CLIENT_SECRET).
- Under Assignments, assign the users/groups who should have gateway access.
- If you want group-based policies later, add a groups claim to the app's ID token (Sign On → OpenID Connect ID Token → Group claims filter) and request the
groupsscope.




The Okta authorization-server choice that matters: Okta has two kinds of authorization server, and they behave differently:
- Org authorization server (
issuer: https://<your-org>.okta.com). Under the Authorization Code (+PKCE) flow this gateway uses, Okta serves the standardemailclaim from the/userinfoendpoint, not the ID token. It does this whenever an access token is issued, which authorization-code always does (per Okta's OIDC reference ). So on the org server you must setoidc.userinfo_fallback: truefor the gateway to reademail. Thegroupsclaim can be placed in the ID token by requesting thegroupsscope and configuring a Group claims filter on the app's Sign On tab, butuserinfo_fallbackcovers it either way.
- Custom authorization server (
issuer: https://<your-org>.okta.com/oauth2/default). Add thegroupsclaim to the ID token explicitly via Security → API → [your authorization server] → Claims.emailis a reserved claim you can't add — Okta rejects it with "The claim name must be unique within an authorization server" — it's served by theemailscope via/userinfoon either server type, so keepoidc.userinfo_fallback: trueregardless. Still the most predictable option for groups and access policies.
Either works; match your
gateway.yaml (Step 3) to the issuer you chose. Okta emits groups only when the groups scope is requested and the Group claims filter allows it.My recommendation: use the custom authorization server (
/oauth2/default ). It gives you an explicit groups claim and full control over access policies, so sign-in behavior doesn't hinge on Okta's fat-vs-thin-token rules. Keep userinfo_fallback: true either way — under the authorization-code flow, email arrives via /userinfo on both server types. I only fall back to the org server when I can't create a custom one.Why not AWS IAM Identity Center? It can't serve as the gateway's identity provider. Identity Center registers custom applications over SAML 2.0 only, and its OIDC surface is an AWS-scoped device grant for CLI and SDK sign-in; not the standard authorization-code endpoint the gateway requires. AWS's sample states it directly : "Not supported: AWS IAM Identity Center (does not support authorization_code grant for custom applications)." If Identity Center fronts your AWS access today, point the gateway at the identity provider behind it, for most organizations that is the same Okta org this guide configures, so nothing new to stand up.
Two sign-in gotchas worth pre-empting (from Anthropic's troubleshooting table): the gateway always rejectsemail_verified: falsewith no override — make sure the user's email is verified in Okta. And if your Okta sign-in redirects through an additional host (an MFA provider, a branded sign-in domain), Chrome can block the Approve button under itsform-actionCSP — add each extra origin tooidc.form_action_origins.
Step 2: Create the IAM task role for Bedrock
The gateway calls Bedrock with its own IAM role. Create a policy scoped to the Claude models (adjust the ARNs for your Regions):
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream" ], "Resource": [ "arn:aws:bedrock:*:ACCOUNT_ID:inference-profile/us.anthropic.*", "arn:aws:bedrock:*::foundation-model/anthropic.*" ] } ]}Grant it on both the inference-profile ARNs and the underlying foundation-model ARNs. Cross-Region inference profiles (
us.anthropic.* ) require model access granted in each Region the profile spans.Create an ECS task role with trust policy
ecs-tasks.amazonaws.com and attach the policy.Step 3: Write gateway.yaml
The gateway reads one YAML file at startup. Five sections are required:
listen , oidc , session , store , and upstreams . Secrets are referenced, not inlined.listen: host: 0.0.0.0 port: 8080 public_url: https://claude-gateway.cc-gw.internal # your private ALB hostname trusted_proxies: [10.0.0.0/8] # your ALB subnet CIDRs
oidc: # Okta CUSTOM authorization server (recommended — see Step 1) issuer: https://<your-org>.okta.com/oauth2/default client_id: <okta-client-id> client_secret: ${OIDC_CLIENT_SECRET} allowed_email_domains: [example.com] userinfo_fallback: true # required on BOTH server types — under auth-code, `email` arrives via /userinfo (see Step 1) scopes: [openid, profile, email, offline_access] # add `groups` ONLY if you've defined that scope and want group-based policies # # --- OR: Okta ORG authorization server — same fields, bare-org issuer --- # issuer: https://<your-org>.okta.com # client_id: <okta-client-id> # client_secret: ${OIDC_CLIENT_SECRET} # allowed_email_domains: [example.com] # userinfo_fallback: true # scopes: [openid, profile, email, offline_access]
session: jwt_secret: ${GATEWAY_JWT_SECRET} # openssl rand -base64 32
store: postgres_url: ${GATEWAY_POSTGRES_URL}
upstreams: - provider: bedrock region: us-east-1 auth: {} # AWS default credential chain (the ECS task role)
# Clients request the Anthropic API model ID; the built-in catalog maps it to the# Bedrock ID automatically. No ARNs needed for the built-in catalog.## Profile prefix choice: this guide uses geo-scoped `us.` profiles (US-only routing,# the data-residency-conscious default). AWS's CDK sample uses `global.anthropic.*`# instead — region-agnostic, routes to any commercial Region — with matching IAM# (`inference-profile/global.anthropic.*`) and model access granted wherever global# may route. Pick one family and keep the IAM ARNs, model access, and this block in sync.auto_include_builtin_models: truemodels: - id: claude-opus-5 label: Claude Opus 5 upstream_model: bedrock: us.anthropic.claude-opus-5 - id: claude-sonnet-5 label: Claude Sonnet 5 upstream_model: bedrock: us.anthropic.claude-sonnet-5
# Optional: central policy by Okta group (allowed models, tool permissions)managed: policies: - match: {} # everyone who authenticates cli: availableModels: [claude-opus-5, claude-sonnet-5, claude-haiku-4-5] permissions: deny: ["WebFetch", "Read(./.env)"]public_url is required behind an ALB: the gateway builds its redirect_uri and discovery metadata from it and deliberately does not trust X-Forwarded-* headers for its own origin.Step 4: Build and push the gateway image to Amazon ECR
You build your own image around the native
claude binary. Per Anthropic's container image requirements , use a glibc-based image and the linux-x64 binary. Download the binary and verify it against the release's GPG-signed manifest.json — the verification is the step most often skipped, and it's essential:# 1) Import Anthropic's release signing key and confirm its fingerprintcurl -fsSL https://downloads.claude.ai/keys/claude-code.asc | gpg --importgpg --fingerprint security@anthropic.com# expect: 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE
# 2) Download the manifest + detached signature for your pinned versionREPO=https://downloads.claude.ai/claude-code-releasesVERSION=2.1.195curl -fsSLO "$REPO/$VERSION/manifest.json"curl -fsSLO "$REPO/$VERSION/manifest.json.sig"
# 3) Verify the signature (expect: Good signature ... security@anthropic.com)gpg --verify manifest.json.sig manifest.json
# 4) Download the linux-x64 binary itself. Do NOT copy your workstation's local# `claude` — on a Mac that's a darwin binary and fails in the container with# "exec format error". This direct URL works from any host:curl -fL -o claude "$REPO/$VERSION/linux-x64/claude"chmod +x claude # curl downloads aren't executable; Docker COPY preserves the mode
# 5) Check the binary's SHA256 against platforms.linux-x64.checksum in manifest.jsonsha256sum claude(Manifest signatures are published for releases from
2.1.89 onward.)You wrote
gateway.yaml in Step 3. Because it contains only ${VAR} references (no secret values), it is not sensitive, so bake it into the image rather than storing it in Secrets Manager:FROM debian:12-slim# CA root certificates — debian:*-slim ships without them; without this, the# gateway's outbound HTTPS (OIDC discovery, Bedrock) fails TLS verification at# the first request even though `docker build` succeeds.RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/*# Pinned, GPG-verified linux-x64 `claude` binaryCOPY claude /usr/local/bin/claude# Non-sensitive config (holds only ${VAR} references)COPY gateway.yaml /etc/claude/gateway.yamlENV CLAUDE_CONFIG_DIR=/tmp/.claudeEXPOSE 8080ENTRYPOINT ["claude", "gateway", "--config", "/etc/claude/gateway.yaml"]aws ecr create-repository --repository-name claude-gateway --region "$AWS_REGION"
aws ecr get-login-password --region "$AWS_REGION" \ | docker login --username AWS --password-stdin "${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com"
docker build --platform=linux/amd64 \ -t "${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/claude-gateway:v1" .docker push "${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/claude-gateway:v1"Expected output (the final push line confirms the image landed in ECR):
Login Succeeded...v1: digest: sha256:9b1c…e4f2 size: 1789Step 5: Provision Amazon RDS for PostgreSQL
Create a private PostgreSQL instance reachable from the gateway task's security group on port 5432:
PGPASS="$(openssl rand -hex 24)"
aws rds create-db-instance \ --db-instance-identifier claude-gateway-db \ --engine postgres --engine-version 16 \ --db-instance-class db.t3.small \ --allocated-storage 20 \ --master-username gateway --master-user-password "$PGPASS" \ --db-name claude_gateway \ --db-subnet-group-name <your-private-db-subnet-group> \ --vpc-security-group-ids <sg-allowing-5432-from-gateway> \ --no-publicly-accessible \ --backup-retention-period 7 \ --region "$AWS_REGION"Once it's available, build the connection URL:
RDS_ENDPOINT=$(aws rds describe-db-instances \ --db-instance-identifier claude-gateway-db \ --query 'DBInstances[0].Endpoint.Address' --output text)
GATEWAY_POSTGRES_URL="postgres://gateway:${PGPASS}@${RDS_ENDPOINT}:5432/claude_gateway?sslmode=require"Expected output (the instance takes ~5–10 minutes to reach
available ; describe-db-instances returns the endpoint once it is):claude-gateway-db.abcdef12345.us-east-1.rds.amazonaws.comThe gateway runs its own schema migrations at boot, so the DB role needs
CREATE TABLE . RDS for PostgreSQL 15+ sets rds.force_ssl=1 by default, so sslmode=require works out of the box on engine 16.Step 6: Store secrets and set up the internal ALB
Store the three real secrets in AWS Secrets Manager (remember:
gateway.yaml is not one of them — it's baked into the image):aws secretsmanager create-secret --name gateway-jwt-secret \ --secret-string "$(openssl rand -base64 32)" --region "$AWS_REGION"aws secretsmanager create-secret --name gateway-oidc-client-secret \ --secret-string "<okta-client-secret>" --region "$AWS_REGION"aws secretsmanager create-secret --name gateway-postgres-url \ --secret-string "$GATEWAY_POSTGRES_URL" --region "$AWS_REGION"A certificate for the internal ALB. You can use a public ACM certificate for
claude-gateway.internal.example.com only if example.com is a real, publicly-controllable domain you can validate via a public DNS record. This works even though the host itself only resolves inside your VPC. If your gateway domain is internal-only (a private-only zone or a made-up suffix ACM can't validate), use AWS Private CA . Distribute its root CA to every developer's OS trust store via MDM, or Claude Code won't trust the gateway's TLS.Create an internal ALB with:
- Scheme internal, IP address type
ipv4(see the gotcha in Step 7), HTTPS listener with the certificate above.
- A target group (HTTP, port 8080) with health check path
/readyz.
- A raised
idle_timeout.timeout_seconds(default 60s) so long streaming responses aren't cut off.
- An internal Amazon Route 53 record for
$GATEWAY_HOSTpointing at the ALB.


Step 7: Deploy the ECS Fargate service
Register a task definition and service with these settings:
-
taskRoleArn= the Bedrock role from Step 2 (the app's runtime permissions).
-
executionRoleArn= a role withAmazonECSTaskExecutionRolePolicy(ECR pull + Amazon CloudWatch Logs) plus an inlinesecretsmanager:GetSecretValueon your three secrets; the managed policy does not include Secrets Manager access, a common configuration oversight.
- Container port 8080, running in private subnets, desired count ≥ 1.
-
gateway.yamlis already on disk (baked into the image). Inject the three secrets as environment variables via the containersecretsblock (GATEWAY_JWT_SECRET,OIDC_CLIENT_SECRET,GATEWAY_POSTGRES_URL); the gateway resolves the${VAR}references at boot.
Why not putgateway.yamlin thesecretsblock? ECSsecrets/valueFrominject values only as environment variables — never as files. There is no native "mount a secret as a file" in ECS/Fargate. Sincegateway.yamlisn't sensitive, baking it into the image (Step 4) is the most direct approach; if you truly need a file from a secret, use a sidecar that writes to a shared volume.
One ALB trap to avoid here — plus an EC2-only aside:
⚠️ Dual-stack internal ALBs hand out public IPv6 (AAAA) records. Claude Code's/loginrequires the gateway hostname to resolve to private addresses only. An internal dual-stack ALB is assigned public-scope IPv6, so its AAAA records fail that check with an error like "Gateway hosts must be on your organization's private network." Create the internal ALB with IP address typeipv4. Avoid every dual-stack option — evendualstack-without-public-ipv4still assigns public-scope IPv6 and publishes AAAA records, which fail the same private-network check.
⚠️ On EC2 launch type, IMDSv2's hop limit blocks credentials. If you run on EC2 instead of Fargate, the SDK can fall back to IMDS (169.254.169.254) for credentials. The metadata hop limit (1 unless raised at the account/AMI level) then blocks the container, and every Bedrock call fails with502 Could not load credentials. ECS task roles avoid this entirely: credentials come from the container-credentials endpoint (169.254.170.2), not IMDS. Fargate has no EC2 IMDS, so this guide is unaffected — the trap matters only if you switch to EC2.
Step 8: Verify the gateway is serving
From a host on the private network:
# End-to-end boot check: 200 only after config load, OIDC discovery,# upstream client construction, and Postgres migration all succeed.curl -s -o /dev/null -w "%{http_code}\n" https://$GATEWAY_HOST/.well-known/oauth-authorization-server
curl -s https://$GATEWAY_HOST/healthz # livenesscurl -s https://$GATEWAY_HOST/readyz # 200 only when the store is reachableExpected output: a healthy gateway returns
200 on the discovery endpoint, and /healthz and /readyz each return a short 200 body once the container has booted and the store is reachable:200If the discovery check returns anything other than
200 , the gateway didn't finish booting. Check the ECS task logs in CloudWatch for an OIDC discovery error (wrong issuer), a Postgres connection failure, or a Bedrock credential error.Confirm the hostname resolves to private addresses only:
dig +short A $GATEWAY_HOSTdig +short AAAA $GATEWAY_HOST # should be empty, or private-scope onlyExpected output: a private A record and no public AAAA record:
10.20.10.42(no output)Step 9: Point developers at the gateway
Developers can't pick the gateway manually — you push the URL via managed settings (MDM). Deploy a per-OS
managed-settings.json :{ "forceLoginMethod": "gateway", "forceLoginGatewayUrl": "https://claude-gateway.internal.example.com"}Platform | Path |
|---|---|
macOS | /Library/Application Support/ClaudeCode/managed-settings.json |
Linux / WSL | /etc/claude-code/managed-settings.json |
Windows | C:\Program Files\ClaudeCode\managed-settings.json |
Now a developer runs
claude /login and approves once in the browser. The gateway uses the RFC 8628 device flow: normally a browser opens to the Okta SSO prompt. On a headless or no-default-browser machine, the terminal instead prints a https://<GATEWAY_HOST>/device?user_code=XXXX-XXXX URL to open manually. If the browser doesn't open on its own, the CLI sits at "waiting for sign in to complete" until you open that URL and approve. Once approved, they're connected. Sessions refresh silently via OIDC refresh tokens; remove a user from Okta and their session expires within session.ttl_hours (default 1 hour).Migrating from a direct-Bedrock setup? A machine whoseCLAUDE_CONFIG_DIRalready holds direct-Bedrock settings (CLAUDE_CODE_USE_BEDROCK=1, a credential helper, orOTEL_*env) can sign in to the gateway successfully yet keep showing the normal account picker or exit oddly — the collision is client-side, between the old settings and the new gateway session. Use a clean config dir; details in the sample's field note# 17 .
Prove the full path lands on Amazon Bedrock. The Step 8 checks prove the gateway is serving; this proves inference actually flows through it. Turn on model invocation logging in the Amazon Bedrock console (Settings → Model invocation logging), send one prompt through the signed-in client, then check three signals, each one layer deeper:
- Gateway audit log (the CloudWatch Logs group from your task definition): a single-line JSON
{"evt":"inference","upstream":"bedrock",…}event per request, with the response status.
- CloudWatch
AWS/Bedrockmetrics: theInvocationsmetric ticks up for your model ID, and the invocation log group records the request.
- AWS CloudTrail: the caller identity is the gateway's task role, not the developer. The audit story in one line: developers never hold or present AWS credentials.


Cost
This deployment is not free-tier. The main always-on components (on-demand
us-east-1 ; per-month at 730 hours; confirm with the AWS Pricing Calculator ):Component | Config | Per hour | Per month |
|---|---|---|---|
ECS Fargate | ~0.5 vCPU / 1 GB, one task | ≈ $0.025 | ≈ $18 |
Amazon RDS | db.t3.small single-AZ + 20 GB gp3 (instance + storage) | ≈ $0.039 | ≈ $29 |
Internal ALB | base + ~1 LCU | ≈ $0.023–0.03 | ≈ $16–22 |
NAT gateway | one, for new-VPC private-subnet egress (+ data processing) | ≈ $0.045 | ≈ $33 |
AWS Secrets Manager | 3 secrets × $0.40/mo | ≈ $0.002 | ≈ $1.20 |
Idle total | infra only, before inference | ≈ $0.13/hr | ≈ $97–110/mo |
Amazon Bedrock | usage-based (per input/output token) | — | typically the largest line item at scale |
Clean up
To avoid ongoing charges, tear everything down when you're done:
# ECS service + task definitionaws ecs update-service --cluster <cluster> --service claude-gateway --desired-count 0 --region "$AWS_REGION"aws ecs delete-service --cluster <cluster> --service claude-gateway --force --region "$AWS_REGION"
# Load balancer + target group (delete the listener/ALB/target group by ARN)aws elbv2 delete-load-balancer --load-balancer-arn <alb-arn> --region "$AWS_REGION"aws elbv2 delete-target-group --target-group-arn <tg-arn> --region "$AWS_REGION"
# RDS (skip the final snapshot only in a throwaway environment)aws rds delete-db-instance --db-instance-identifier claude-gateway-db \ --skip-final-snapshot --delete-automated-backups --region "$AWS_REGION"
# Secretsfor s in gateway-jwt-secret gateway-oidc-client-secret gateway-postgres-url; do aws secretsmanager delete-secret --secret-id "$s" --force-delete-without-recovery --region "$AWS_REGION"done
# ECR repository (and images)aws ecr delete-repository --repository-name claude-gateway --force --region "$AWS_REGION"Also remove the Route 53 record, the ACM/Private CA certificate if you no longer need it, and the Okta app integration.
Conclusion and next steps
You now have a self-hosted Claude apps gateway on AWS. It authenticates developers through Okta, routes inference to Amazon Bedrock, governs identity, policy, and cost from one place, and keeps long-lived AWS credentials off developer laptops. The two traps from Steps 6–7 (the IPv4-only ALB and the TLS trust decision) are handled up front.
The shape here is a reusable pattern: a self-hosted, OIDC-authenticated proxy that holds one cloud credential and fans out to a managed API. Once you've built it for Claude Code, the same skeleton applies: internal ALB + Fargate + RDS state + an IAM task role for egress. That skeleton drops onto any tool that needs central SSO, per-user attribution, and spend control without handing every user a cloud key.
Where to go next:
- Move to infrastructure-as-code: once you understand the pieces, AWS's CDK sample deploys the same architecture (ECS + ALB + RDS + IAM + DNS) as a maintained stack, and its gotchas file documents traps beyond the two covered here (distroless file permissions, telemetry-collector TLS, and more).
- For production HA, run the service at desired count ≥ 2 across AZs and enable RDS Multi-AZ. The gateway is stateless, so it scales horizontally with no shared state beyond Postgres.
- Add spend caps with an
admin:block and per-group daily/weekly/monthly limits; Anthropic's spend limits guide covers caps, resolution order, and the admin API.
- Wire telemetry (
telemetry.forward_to) to Amazon CloudWatch or Amazon Managed Service for Prometheus for per-developer usage attribution. Note the collector endpoint must behttps://(the gateway rejects plain-HTTP non-loopback targets, and the stockaws-otel-collectordoesn't serve TLS out of the box; see the sample's field notes).
- Add cross-Region / cross-account Bedrock upstreams for failover: one
upstreamsentry per account, each with its own credentials (see the configuration reference's multiple-upstreams section ).
- Tighten managed policies per Okta group (allowed models, tool permissions); the configuration reference documents the policy schema.
This article is Part 1 of a series. Deploying the gateway is half the story — running it is the other half. Part 2, Operating the Claude apps gateway: spend limits, the admin API, and per-user observability, covers the day-2 topics the last three bullets point at: how spend caps actually resolve and fail, the admin API's two authentication paths and their different audit trails, wiring per-developer usage into CloudWatch past the TLS collector trap, and the web-based admin console AWS now ships in a separate sample repository .
References
- AWS: Claude apps gateway CDK sample (one-command deploy) · deployment guide · field notes / gotchas
- AWS: Claude apps gateway sample with admin console (separate repository: ECS Express Mode, web console, Client VPN)
- Anthropic: Claude apps gateway overview
- Anthropic: Configuration reference (
gateway.yaml)
- Anthropic: Deployment & operations
Questions, or did I miss a trap you hit? Leave a comment.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article