Configure Codex to use AWS Bedrock

Configure Codex CLI, ChatGPT MacOS app or Codex VSCode extension to use AWS Bedrock

2 min read
#ai #ai-coding-agent #codex #vscode

In April 2026, OpenAI and Microsoft Azure ended their exclusive partnership https://blogs.microsoft.com/blog/2026/04/27/the-next-phase-of-the-microsoft-openai-partnership/ and OpenAI launched OpenAI models on AWS https://openai.com/index/openai-on-aws/

Since then, it become feasible for OpenAI users to configure Codex to use OpenAI models hosted on AWS Bedrock. If you’d like Codex to use AWS Bedrock (say because your employer has an AWS account but not an OpenAI account), follow the steps below.

Install codex CLI or the ChatGPT MacOS app (if you haven’t already) https://developers.openai.com/codex/cli/

Visit your Bedrock dashboard and generate an API key https://607420117092-ntzqekvz.us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/api-keys?tab=long-term

Open Codex’s config file

nano ~/.codex/config.toml

and change your model provider to aws-bedrock and configure an AWS region to use

model_provider = "amazon-bedrock"
model = "openai.gpt-5.6-sol"
model_reasoning_effort = "medium"

[model_providers.amazon-bedrock.aws]
region = "us-east-2"

Then, add an AWS profile to use

[model_providers.amazon-bedrock.aws]
region = "us-east-2"
profile = "your-aws-profile-name"

or alternatively, generate a Bedrock API key and export it to the AWS_BEARER_TOKEN_BEDROCK env var

export AWS_BEARER_TOKEN_BEDROCK="your-bedrock-api-key"

If you’re using the Codex Desktop app or Codex VSCode extension, create a ~/.codex/.env file instead and add

AWS_BEARER_TOKEN_BEDROCK="your-bedrock-api-key"

Start codex (or start/restart the ChatGPT MacOS app or VSCOde)

codex

To see all available models in AWS Bedrock, visit https://docs.aws.amazon.com/bedrock/latest/userguide/models-endpoint-availability.html Alternatively, run

AWS_REGION=us-east-2 awscurl --service bedrock-mantle https://bedrock-mantle.us-east-1.api.aws/v1/models | jq -r ".data[].id" | grep "openai"

Visit the Resources below for more information on configuring Codex to use AWS Bedrock

Resources