Set up OpenAI ChatGPT Codex with LiteLLM on Amazon ECS and Amazon Bedrock
aws ·
The article explains how to deploy a customer-operated LiteLLM gateway on Amazon ECS to manage OpenAI Codex coding agents while routing model inference through Amazon Bedrock. This setup provides centralized controls such as authentication, budgets, rate limits, and telemetry, while Codex still runs its local task and tool-execution loop on the developer workstation. The architecture places LiteLLM between Codex and Bedrock, with traffic flowing through an Application Load Balancer and AWS WAF before reaching LiteLLM on AWS Fargate. Supporting components include Amazon RDS for PostgreSQL for state and budgets, Secrets Manager and KMS for key storage, CloudWatch for logs and alarms, and ECR for the gateway image. The post includes a step-by-step deployment using a reference repository, with commands to build the image, create a CloudFormation change set, deploy the stack, and provision a scoped gateway identity. It also shows how to configure Codex to use the gateway's Responses API and retrieve credentials dynamically via an AWS CLI script. The authors note the trade-off of operational responsibility and suggest when direct IAM access or a managed gateway like Portkey might be more appropriate. The implementation is available in the guidance-codex repository, and the walkthrough was validated in the US East (N. Virginia) Region.
aws