# avashya-tech-llp/claude-apps-gateway-on-eks architecture

> Architecture diagram of the GitHub repository avashya-tech-llp/claude-apps-gateway-on-eks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avashya-tech-llp/claude-apps-gateway-on-eks
- Repository: https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks

## Overview

#### Purpose and Entry Points
This repository provisions a private Claude Apps Gateway on AWS EKS. Claude Code and Claude Desktop authenticate through an enterprise OIDC provider and send inference traffic to the organization’s HTTPS gateway rather than Anthropic directly.

Primary deployment entry point: `Terraform/main.tf`. Container image build/publish entry point: `docker/claude-gateway/build-and-push.sh`. Client routing is managed by `scripts/switch-claude-code-to-gateway.sh` and `scripts/setup-claude-desktop.sh`.

#### Infrastructure Composition
Terraform is organized as a root composition layer plus reusable AWS modules:
- Root providers, state/backend, inputs, and outputs: `Terraform/providers.tf`, `Terraform/backend.tf`, `Terraform/main.tf`.
- Network foundation: VPC, subnets, NAT, and private-service endpoints in `Terraform/modules/networking/networking.tf` and `Terraform/modules/networking/vpc_endpoints.tf`.
- Kubernetes control plane and managed capacity: `Terraform/modules/eks/eks.tf`.
- Cluster integrations, notably AWS Load Balancer Controller and EBS CSI: `Terraform/modules/eks-addons/addons.tf`.
- Optional DNS automation: `Terraform/modules/route53/route53.tf`.

#### Gateway Workload Boundary
The central deployment module is `Terraform/modules/claude-gateway/main.tf`. It declares the `claude-system` Kubernetes workload stack: gateway pod, ingress/ALB exposure, service identity, persistence-backed services, and optional observability components.

The gateway is built as a custom image wrapping Anthropic’s Claude Code package: `docker/claude-gateway/Dockerfile`. The build script publishes it to Amazon ECR, which is the runtime image source.

#### Request and Identity Flow
Client applications are configured to call the gateway hostname over TLS. An internet-facing AWS ALB terminates HTTPS using a supplied ACM certificate and forwards traffic into EKS.

Within the pod, nginx accepts traffic on port 8080 and forwards to the gateway on 8081. Optional `ttl-proxy` on 8082 removes unsupported `cache_control.ttl` fields for Claude 3.x APAC Bedrock models. The gateway uses external OIDC for per-user authentication and authorization; client scripts establish this gateway/OIDC configuration.

#### AWS Authorization and Inference Boundary
The gateway ServiceAccount receives AWS permissions through IRSA rather than static cloud credentials. This lets the running gateway invoke AWS Bedrock while maintaining a Kubernetes-to-IAM trust boundary. Bedrock region, OIDC settings, domain allow-listing, replicas, and feature flags are module inputs defined through `Terraform/modules/claude-gateway/variables.tf` and root `Terraform/variables.tf`.

External dependencies are AWS EKS, ALB, ACM, ECR, IAM/IRSA, Bedrock, and an organization-managed OIDC provider. Route53 is optional.

#### State, Monitoring, and Operations
Postgres stores gateway state; Loki and Grafana provide optional in-cluster observability. When monitoring is enabled, an OTel sidecar exposes telemetry and a log-forwarder forwards enhanced logs. Relevant assets include `Terraform/modules/claude-gateway/log-forwarder-enhanced.py`, `Terraform/modules/claude-gateway/grafana-dashboard.json`, and `Terraform/modules/claude-gateway/grafana-dashboard-otel.json`.

Operational procedures and architectural rationale are concentrated in `docs/RUNBOOK.md`, `docs/ARCHITECTURE.md`, and `docs/LOGGING.md`. Backup/restore scripts preserve local Claude client configuration: `scripts/backup-claude-config.sh` and `scripts/restore-claude-config.sh`.

Main entry points: [`Terraform/main.tf`](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/main.tf) (Terraform composition), [`Terraform/modules/claude-gateway/main.tf`](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/claude-gateway/main.tf) (Gateway deployment), [`Terraform/modules/networking/networking.tf`](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/networking/networking.tf) (Network foundation), [`Terraform/modules/eks/eks.tf`](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/eks/eks.tf) (EKS cluster & capacity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client access"]
  node_client_scripts["Client routing setup<br/>shell scripts"]
  node_claude_clients["Claude Code &amp; Desktop<br/>clients"]
  node_enterprise_oidc{{"Enterprise OIDC provider<br/>identity provider"}}
end

subgraph group_provisioning["Infrastructure delivery"]
  node_terraform_root["Terraform composition<br/>Terraform root<br/>[main.tf]"]
  node_networking_module["Network foundation<br/>Terraform module<br/>[networking.tf]"]
  node_eks_module["EKS cluster &amp; capacity<br/>Terraform module<br/>[eks.tf]"]
  node_eks_addons["EKS integrations<br/>Terraform module<br/>[addons.tf]"]
  node_route53_module["Optional DNS automation<br/>Terraform module<br/>[route53.tf]"]
  node_image_build["Gateway image build<br/>build script<br/>[build-and-push.sh]"]
end

subgraph group_aws["AWS platform"]
  node_ecr[("Amazon ECR<br/>container registry")]
  node_vpc["Private VPC<br/>network"]
  node_eks{{"Amazon EKS<br/>Kubernetes platform"}}
  node_alb_acm["HTTPS ALB + ACM<br/>ingress"]
  node_iam_irsa{{"IAM / IRSA<br/>workload identity"}}
  node_bedrock["AWS Bedrock<br/>inference service"]
end

subgraph group_gateway["Gateway workload"]
  node_gateway_module["Gateway deployment<br/>Terraform module<br/>[main.tf]"]
  node_gateway_pod["Gateway pod<br/>Kubernetes workload"]
  node_postgres[("Postgres<br/>state store")]
end

subgraph group_operations["Operations"]
  node_observability["Optional observability<br/>Loki, Grafana &amp; OTel"]
  node_runbooks["Runbooks &amp; architecture<br/>documentation<br/>[RUNBOOK.md]"]
end

node_client_scripts -->|"configures"| node_claude_clients
node_claude_clients -->|"authenticates with"| node_enterprise_oidc
node_claude_clients -->|"HTTPS inference requests"| node_alb_acm
node_terraform_root -->|"composes"| node_networking_module
node_terraform_root -->|"composes"| node_eks_module
node_terraform_root -->|"composes"| node_eks_addons
node_terraform_root -.->|"optionally composes"| node_route53_module
node_terraform_root -->|"composes"| node_gateway_module
node_networking_module -->|"provisions"| node_vpc
node_eks_module -->|"provisions"| node_eks
node_vpc -->|"hosts"| node_eks
node_eks_addons -->|"integrates ingress"| node_alb_acm
node_image_build -->|"publishes image"| node_ecr
node_gateway_module -->|"deploys into"| node_eks
node_gateway_module -->|"declares"| node_gateway_pod
node_ecr -->|"runtime image"| node_gateway_pod
node_alb_acm -->|"forwards TLS traffic"| node_gateway_pod
node_gateway_pod -->|"validates user identity"| node_enterprise_oidc
node_gateway_pod -->|"uses ServiceAccount"| node_iam_irsa
node_iam_irsa -->|"authorizes invocation"| node_bedrock
node_gateway_pod -->|"invokes inference"| node_bedrock
node_gateway_pod -->|"persists state"| node_postgres
node_gateway_pod -.->|"emits logs and telemetry"| node_observability
node_runbooks -.->|"operates"| node_gateway_module

click node_client_scripts "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/scripts/switch-claude-code-to-gateway.sh"
click node_terraform_root "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/main.tf"
click node_networking_module "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/networking/networking.tf"
click node_eks_module "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/eks/eks.tf"
click node_eks_addons "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/eks-addons/addons.tf"
click node_route53_module "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/route53/route53.tf"
click node_image_build "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/docker/claude-gateway/build-and-push.sh"
click node_gateway_module "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/claude-gateway/main.tf"
click node_observability "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/claude-gateway/log-forwarder-enhanced.py"
click node_runbooks "https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/docs/RUNBOOK.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_scripts,node_claude_clients,node_enterprise_oidc toneBlue
class node_terraform_root,node_networking_module,node_eks_module,node_eks_addons,node_route53_module,node_image_build toneAmber
class node_ecr,node_vpc,node_eks,node_alb_acm,node_iam_irsa,node_bedrock toneMint
class node_gateway_module,node_gateway_pod,node_postgres toneRose
class node_observability,node_runbooks toneIndigo
```

## Components

### Client access

- [Client routing setup](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/scripts/switch-claude-code-to-gateway.sh): shell scripts · Configures Claude Code and Desktop for gateway OIDC routing. · `scripts/switch-claude-code-to-gateway.sh`
- **Claude Code & Desktop**: clients
- **Enterprise OIDC provider**: identity provider

### Infrastructure delivery

- [Terraform composition](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/main.tf): Terraform root · Composes providers, state, inputs, modules, and outputs. · `Terraform/main.tf`
- [Network foundation](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/networking/networking.tf): Terraform module · VPC, private subnets, NAT, and service endpoints. · `Terraform/modules/networking/networking.tf`
- [EKS cluster & capacity](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/eks/eks.tf): Terraform module · `Terraform/modules/eks/eks.tf`
- [EKS integrations](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/eks-addons/addons.tf): Terraform module · Installs Load Balancer Controller and EBS CSI. · `Terraform/modules/eks-addons/addons.tf`
- [Optional DNS automation](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/route53/route53.tf): Terraform module · `Terraform/modules/route53/route53.tf`
- [Gateway image build](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/docker/claude-gateway/build-and-push.sh): build script · `docker/claude-gateway/build-and-push.sh`

### AWS platform

- **Amazon ECR**: container registry
- **Private VPC**: network
- **Amazon EKS**: Kubernetes platform
- **HTTPS ALB + ACM**: ingress · Internet-facing TLS termination and forwarding.
- **IAM / IRSA**: workload identity · Kubernetes ServiceAccount-to-IAM trust boundary.
- **AWS Bedrock**: inference service

### Gateway workload

- [Gateway deployment](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/claude-gateway/main.tf): Terraform module · Declares the claude-system workload, ingress, identity, persistence, and optional monitoring. · `Terraform/modules/claude-gateway/main.tf`
- **Gateway pod**: Kubernetes workload · nginx :8080 forwards to gateway :8081; optional ttl-proxy runs on :8082.
- **Postgres**: state store · Stores gateway state.

### Operations

- [Optional observability](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/Terraform/modules/claude-gateway/log-forwarder-enhanced.py): Loki, Grafana & OTel · OTel sidecar and log-forwarder provide telemetry and enhanced logs. · `Terraform/modules/claude-gateway/log-forwarder-enhanced.py`
- [Runbooks & architecture](https://github.com/avashya-tech-llp/claude-apps-gateway-on-eks/blob/main/docs/RUNBOOK.md): documentation · `docs/RUNBOOK.md`

## Connections

- Client routing setup → Claude Code & Desktop: configures
- Claude Code & Desktop → Enterprise OIDC provider: authenticates with
- Claude Code & Desktop → HTTPS ALB + ACM: HTTPS inference requests
- Terraform composition → Network foundation: composes
- Terraform composition → EKS cluster & capacity: composes
- Terraform composition → EKS integrations: composes
- Terraform composition → Optional DNS automation: optionally composes
- Terraform composition → Gateway deployment: composes
- Network foundation → Private VPC: provisions
- EKS cluster & capacity → Amazon EKS: provisions
- Private VPC → Amazon EKS: hosts
- EKS integrations → HTTPS ALB + ACM: integrates ingress
- Gateway image build → Amazon ECR: publishes image
- Gateway deployment → Amazon EKS: deploys into
- Gateway deployment → Gateway pod: declares
- Amazon ECR → Gateway pod: runtime image
- HTTPS ALB + ACM → Gateway pod: forwards TLS traffic
- Gateway pod → Enterprise OIDC provider: validates user identity
- Gateway pod → IAM / IRSA: uses ServiceAccount
- IAM / IRSA → AWS Bedrock: authorizes invocation
- Gateway pod → AWS Bedrock: invokes inference
- Gateway pod → Postgres: persists state
- Gateway pod → Optional observability: emits logs and telemetry
- Runbooks & architecture → Gateway deployment: operates
