跳转到内容

Bedrock GovCloud 配置

如需完整文档索引,请参阅 llms.txt。文档页面的 Markdown 版本可通过在页面后追加 .md 来获取 URL。

本指南介绍如何配置 Codex 以便在 GovCloud中通过 Amazon Bedrock 执行推理。我们将介绍 AWS 访问权限、受管设备设置和网络控制措施。

Codex 配置参考

本指南不构成法律建议,也不授予运行授权 (ATO)。请与安全和授权官员一起,根据贵机构的 AWS 要求和系统安全计划,审查配置、选定的 服务、端点控制以及 数据流。

请查看 AWS 共享责任模型 以及所选服务的文档,以了解 AWS 所提供的控制措施。贵机构负责批准使用这些服务。

在受支持的部署中, Codex 会使用 AWS 身份验证,向配置的 Bedrock 端点发送推理请求。贵组织负责保护运行 Codex的设备,包括凭据、代码库、本地记录和已启用的第三方服务。使用 GovCloud 进行推理,并不能证明整个工作流符合贵机构的要求。

验证清单 · 功能设置

使用桌面应用版本 26.1002.51308 或更高版本,如 **“关于”**所示。

准备 所需内容
AWS 访问权限 一个 AWS GovCloud 可访问所用 Bedrock 模型的账户。
配置 经过审核的 requirements.toml、已批准的网络目标,以及回滚说明。
设备管理 系统配置或 MDM 访问权限,以及针对应用、设备和代理命令的网络策略。

通过系统配置或 requirements.toml 进行部署 MDM ,并在应用启动前完成。请按照 托管配置 中的文件位置和 MDM 交付方式进行操作。保护托管策略,并在运行 Codex 的设备上验证其设置 第 3 步。

下方的默认 requirements.toml 配置有意设置得较为严格。管理员可以在接受相关风险后启用其他功能。请参阅 功能文档 和 网络控制文档。

requirements.toml

# Disable ChatGPT sign-in.
allowed_login_methods = ["api"]
# /docs/agent-approvals-security#common-sandbox-and-approval-combinations
allowed_sandbox_modes = ["read-only", "workspace-write"]
# Approval prompts are reviewed by the user.
allowed_approvals_reviewers = ["user"]
allowed_approval_policies = [
{ granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = true } },
]
# Allow cached search only if your AWS GovCloud Region supports web search.
allowed_web_search_modes = ["disabled", "cached"]
# Block agent browser use and native-app control.
allow_browser_and_computer_use = false
# Appshots: /docs/appshots
allow_appshots = false
# Remote control: /docs/remote-connections#pick-up-work-from-another-device
allow_remote_control = false
# Managed hooks: /docs/enterprise/managed-configuration#enforce-managed-hooks-from-requirements
allow_managed_hooks_only = true
check_for_update_on_startup = false
# MCP servers, apps, and plugins are disabled by default.
# Admins can enable supported integrations after accepting the risks
# for their use case and configuring access and network controls.
# /docs/enterprise/managed-configuration
mcp_servers = {}
[features]
apps = false
enable_mcp_apps = false
plugins = false
# Enable the network proxy for sandboxed commands.
# /docs/agent-approvals-security#network-isolation
network_proxy = true
in_app_dictation = false
realtime_conversation = false
# Browser controls: /docs/enterprise/managed-configuration#disable-codex-feature-surfaces
# Note that both browser use and computer use are up to your organization's risk appetite.
# An agent using your browser or computer may navigate to any websites or applications that the
# computer has access to. OpenAI does not currently provide additional protections restricting
# the network paths that browser use and computer use may exercise.
in_app_browser = false
browser_use = false
browser_use_external = false
browser_use_full_cdp_access = false
# Computer Use: /docs/computer-use
# Enable after accepting the risks and configuring app and network access.
computer_use = false
# Set to true to let users update through the app.
# App-store, package-manager, and MDM updates are controlled separately.
# /docs/enterprise/manage-app-updates#turn-off-in-app-updates
in_app_updates = false
image_generation = false
# Memories: /docs/customization/memories
memories = false
# Computer History: /docs/customization/computer-history
chronicle = false
external_agent_memory_import = false
# We recommend that users review approval requests themselves.
# Admins can enable automatic review after accepting the risks for their use case.
# /docs/agent-approvals-security#automatic-approval-reviews
guardian_approval = false
guardianv2 = false
# Disable background skill-search experiments.
skill_search = false
# Hooks: /docs/hooks
hooks = false
# If you enable web search, use cached search through Bedrock Mantle
# where supported by your AWS GovCloud Region.
standalone_web_search = false
# Disable feedback submissions to OpenAI.
[feedback]
enabled = false
# Network controls for agent commands:
# /docs/enterprise/managed-configuration#configure-network-access-requirements
[experimental_network]
enabled = true
managed_allowed_domains_only = true
# No domains allowed by default. Add destinations approved for your use case.
domains = {}
# Add approved Unix socket paths here.
unix_sockets = {}
# Set to true when using an organization-approved upstream proxy.
allow_upstream_proxy = false
# Keep the command proxy bound to localhost.
dangerously_allow_non_loopback_proxy = false
dangerously_allow_all_unix_sockets = false
# Local/private networking: /docs/agent-approvals-security#local-and-private-destinations
allow_local_binding = false
# App network controls: /docs/enterprise/managed-configuration#control-desktop-app-network-destinations
[application.network]
enabled = true
# Example: Bedrock Mantle in us-gov-west-1.
# Replace this hostname with the Bedrock endpoint configured in config.toml.
[application.network.domains]
"bedrock-mantle.us-gov-west-1.api.aws" = "allow"
# OpenAI and ChatGPT endpoints.
# We recommend denying these endpoints to avoid any risk that user data is sent to commercial OpenAI infrastructure.
"api.openai.com" = "deny"
"chat.openai.com" = "deny"
"chatgpt.com" = "deny"
"ab.chatgpt.com" = "deny"
"platform.openai.com" = "deny"
"auth.openai.com" = "deny"
"gov.api.openai.com" = "deny"
"gov.chatgpt.com" = "deny"
"sdfedpreastus2.oaiusercontent.com" = "deny"
"o33249.ingest.us.sentry.io" = "deny"
"persistent.oaistatic.com" = "deny"
"oaisidekickupdates.blob.core.windows.net" = "deny"
# Windows only: /docs/config-file/config-reference#requirementstoml
[windows]
allowed_sandbox_implementations = ["elevated"]

在 config.toml 或托管默认值中设置提供商、模型、区域和端点。用户可以在 requirements.toml设定的限制范围内更改这些默认值。

以下示例在 us-gov-west-1中使用 Mantle。请将模型 ID 和 AWS 配置文件替换为部署所用的值。若使用其他受支持的区域或端点,请同时更新 URL、区域和网络策略。

该示例关闭了可选诊断和数据共享。请将 AWS 凭据保存在 TOML 文件之外。请将 AWS 配置文件、凭据和凭据助手脚本放在 Codex 无法修改的文件夹之外。

config.toml

# Replace with your approved Bedrock model ID.
model = "openai.gpt-5.6-terra"
model_provider = "amazon-bedrock"
approval_policy = { granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = true } }
sandbox_mode = "workspace-write"
# Set to "cached" only when supported by your model and GovCloud Region
# and approved for your deployment.
# https://docs.aws.amazon.com/bedrock/latest/userguide/web-search.html
web_search = "disabled"
# Example: Bedrock Mantle in us-gov-west-1.
[model_providers.amazon-bedrock]
base_url = "https://bedrock-mantle.us-gov-west-1.api.aws/openai/v1"
wire_api = "responses"
requires_openai_auth = false
[model_providers.amazon-bedrock.aws]
region = "us-gov-west-1"
# Replace with your AWS profile name.
profile = "codex-govcloud"
[sandbox_workspace_write]
# Command destinations are controlled by requirements.toml.
network_access = true
# Disable sending Codex usage analytics to OpenAI.
[analytics]
enabled = false
# OpenTelemetry exports are off by default.
# Admins can configure an approved collector for logs, traces, and metrics.
# /docs/config-file/config-advanced#observability-and-telemetry
[otel]
exporter = "none"
trace_exporter = "none"
metrics_exporter = "none"
log_user_prompt = false

该示例使用 AWS 凭据搭配 Bedrock Mantle。若使用 Bedrock Runtime 或网关,请遵循 提供商设置说明。

将包括 Bedrock 在内的已批准应用目标添加到 application.network.domains。将已批准的命令目标添加到 experimental_network.domains。

Codex的网络设置不能替代设备防火墙。

  1. 确认策略已启用,并确认 Codex 正在使用预期的 AWS 凭据和 Bedrock 设置。
  2. 使用示例数据运行已批准的工作流。
  3. 确认用户设置无法覆盖托管限制。
  4. 测试无效或过期凭据以及路由故障。确认内容不会发送到未经批准的目标。

问题 检查内容
不受支持的端点 请向 OpenAI 确认已安装的桌面应用和应用服务器版本支持该端点和模型。
错误的 AWS 账户或角色 检查当前使用的凭据和所选 AWS 配置文件。Bedrock API 密钥可能优先于配置文件。
未应用限制 确认预期的 requirements.toml 已加载到运行 Codex的设备上。
功能仍不可用 查看功能文档,了解所需设置和 Bedrock 支持情况,然后检查网络控制。

用户无法覆盖由 requirements.toml强制执行的功能设置。

下表总结了上述配置。 “开启” 表示在受支持的情况下允许使用;其他权限和网络控制仍然适用。

有关提供商支持情况,请参阅 Bedrock 功能可用性。

功能 默认设置 备注
本地编码、文件、Git 和子代理 开启 —
本地计划任务 开启 —
浏览器 关闭 包括内置浏览器、已连接的浏览器、代理浏览器控制和开发者模式。
Computer Use 和 Appshots 关闭 —
Memory 和 Computer History 关闭 —
图像生成 关闭 不影响图像输入或读取现有图像文件。
网页搜索 关闭 缓存搜索需要模型和 GovCloud 区域提供支持。命令网络规则不会限制托管式搜索。
应用和插件 关闭 —
已配置的 MCP 服务器 关闭 管理员在接受其用例相关风险并配置访问权限和网络控制后,可以启用已批准的服务器。
交互式 MCP 应用 关闭 —
听写 关闭 —
自动审批审查 关闭 —
远程控制 关闭 SSH 连接是独立的。
应用更新 关闭 —

启用代理浏览器使用或 Computer Use 还需要 allow_browser_and_computer_use = true。

验证清单 · 功能设置

配置 Codex CLI 以便在 Amazon Bedrock 中执行推理 GovCloud。关于 共同责任指南 也适用于 CLI 部署。

开始之前

安装 Codex CLI 并检查已安装的版本:

Terminal window
codex --version

使用 Codex CLI 0.162.0 或更高版本。

你需要一个 AWS GovCloud 可访问所用 Bedrock 模型的账户,以及管理员权限,以便在运行 requirements.toml 的设备上部署 Codex。对于 WSL 或 SSH,请在运行 CLI 的环境中应用配置。

1. 部署设备要求

通过系统配置或 requirements.toml 进行部署 MDM ,并在 CLI 启动前完成。请按照 托管配置 中的文件位置和 MDM 交付方式进行操作。保护托管策略,并在运行 Codex 的设备上验证其设置 第 3 步。

下方的默认 requirements.toml 配置有意设置得较为严格。管理员可以在接受相关风险后启用其他功能。请参阅 功能文档 和 网络控制文档。

requirements.toml

# Disable ChatGPT sign-in.
allowed_login_methods = ["api"]
# /docs/agent-approvals-security#common-sandbox-and-approval-combinations
allowed_sandbox_modes = ["read-only", "workspace-write"]
# Approval prompts are reviewed by the user.
allowed_approvals_reviewers = ["user"]
allowed_approval_policies = [
{ granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = true } },
]
# Allow cached search only if your AWS GovCloud Region supports web search.
allowed_web_search_modes = ["disabled", "cached"]
# Remote control: /docs/cli/reference#codex-remote-control
allow_remote_control = false
# Managed hooks: /docs/enterprise/managed-configuration#enforce-managed-hooks-from-requirements
allow_managed_hooks_only = true
check_for_update_on_startup = false
# MCP servers, apps, and plugins are disabled by default.
# Admins can enable supported integrations after accepting the risks
# for their use case and configuring access and network controls.
# /docs/enterprise/managed-configuration
mcp_servers = {}
[features]
apps = false
plugins = false
# Enable the network proxy for sandboxed commands.
# /docs/agent-approvals-security#network-isolation
network_proxy = true
realtime_conversation = false
image_generation = false
# Memories: /docs/customization/memories
memories = false
external_agent_memory_import = false
# We recommend that users review approval requests themselves.
# Admins can enable automatic review after accepting the risks for their use case.
# /docs/agent-approvals-security#automatic-approval-reviews
guardian_approval = false
guardianv2 = false
# Disable background skill-search experiments.
skill_search = false
# Hooks: /docs/hooks
hooks = false
# If you enable web search, use cached search through Bedrock Mantle
# where supported by your AWS GovCloud Region.
standalone_web_search = false
# Disable feedback submissions to OpenAI.
[feedback]
enabled = false
# Network controls for agent commands:
# /docs/enterprise/managed-configuration#configure-network-access-requirements
[experimental_network]
enabled = true
managed_allowed_domains_only = true
# No domains allowed by default. Add destinations approved for your use case.
domains = {}
# Add approved Unix socket paths here.
unix_sockets = {}
# Set to true when using an organization-approved upstream proxy.
allow_upstream_proxy = false
# Keep the command proxy bound to localhost.
dangerously_allow_non_loopback_proxy = false
dangerously_allow_all_unix_sockets = false
# Local/private networking: /docs/agent-approvals-security#local-and-private-destinations
allow_local_binding = false
# Application network controls: /docs/config-file/config-reference#requirementstoml
[application.network]
enabled = true
# Example: Bedrock Mantle in us-gov-west-1.
# Replace this hostname with the Bedrock endpoint configured in config.toml.
[application.network.domains]
"bedrock-mantle.us-gov-west-1.api.aws" = "allow"
# OpenAI and ChatGPT endpoints.
# We recommend denying these endpoints to avoid any risk that user data is sent to commercial OpenAI infrastructure.
"api.openai.com" = "deny"
"chat.openai.com" = "deny"
"chatgpt.com" = "deny"
"ab.chatgpt.com" = "deny"
"platform.openai.com" = "deny"
"auth.openai.com" = "deny"
"gov.api.openai.com" = "deny"
"gov.chatgpt.com" = "deny"
"sdfedpreastus2.oaiusercontent.com" = "deny"
"o33249.ingest.us.sentry.io" = "deny"
"persistent.oaistatic.com" = "deny"
"oaisidekickupdates.blob.core.windows.net" = "deny"
# Windows only: /docs/config-file/config-reference#requirementstoml
[windows]
allowed_sandbox_implementations = ["elevated"]

将 config.toml 放入 ~/.codex/config.toml Linux 上的 macOS,或放入 %USERPROFILE%\.codex\config.toml Windows 上的 CODEX_HOME。如果设置了 config.toml ,请改用其 requirements.toml。用户可以在

设定的限制范围内更改这些默认值。 config.toml

Section titled “设定的限制范围内更改这些默认值。 config.toml”

推荐 us-gov-west-1该示例在 ID 中使用 Mantle。请将模型 AWS 和 URL配置文件替换为部署所用的值。若使用其他受支持的区域或端点,请同时更新

、区域和网络策略。 AWS 请将 TOML 凭据保存在 AWS 文件之外。请将 Codex 配置文件、凭据和凭据助手脚本放在 CLI 无法修改的文件夹之外。 AWS 。此提供商的 ChatGPT 使用 OpenAI API 凭据; 无需登录或使用密钥。请参阅

config.toml

# Replace with your approved Bedrock model ID.
model = "openai.gpt-5.6-terra"
model_provider = "amazon-bedrock"
approval_policy = { granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = true } }
sandbox_mode = "workspace-write"
# Set to "cached" only when supported by your model and GovCloud Region
# and approved for your deployment.
# https://docs.aws.amazon.com/bedrock/latest/userguide/web-search.html
web_search = "disabled"
# Example: Bedrock Mantle in us-gov-west-1.
[model_providers.amazon-bedrock]
base_url = "https://bedrock-mantle.us-gov-west-1.api.aws/openai/v1"
wire_api = "responses"
requires_openai_auth = false
[model_providers.amazon-bedrock.aws]
region = "us-gov-west-1"
# Replace with your AWS profile name.
profile = "codex-govcloud"
[sandbox_workspace_write]
# Command destinations are controlled by requirements.toml.
network_access = true
# Disable sending Codex usage analytics to OpenAI.
[analytics]
enabled = false
# OpenTelemetry exports are off by default.
# Admins can configure an approved collector for logs, traces, and metrics.
# /docs/config-file/config-advanced#observability-and-telemetry
[otel]
exporter = "none"
trace_exporter = "none"
metrics_exporter = "none"
log_user_prompt = false

Bedrock 身份验证选项

。 CLI 应用网络控制 application.network.domains将已批准的 experimental_network.domains目标(包括 Bedrock)添加到

。将已批准的命令目标添加到 CLI 0.162.0。这些是彼此独立的控制:允许 Bedrock 处理模型请求,并不意味着代理命令也可以连接到它。 codex exec 在 application.network 中,交互式会话和 Codex会将 codex login 应用于 Codex的模型和服务请求。它不涵盖独立的

或守护进程更新下载。

的网络设置不能替代设备防火墙。请使用防火墙限制这些目标和凭据助手的流量。 CLI 3. 验证部署

Terminal window
codex
  1. 更改配置后,请启动新的 /status 进程。在代码仓库中运行: AWS 打开
  2. 并确认模型和提供商。检查已配置的
  3. 配置文件是否使用预期的凭据。 CLI 使用示例数据运行已批准的工作流。
  4. 确认用户设置和

标志无法覆盖托管限制。

Terminal window
codex exec --sandbox read-only "Reply with exactly: bedrock-ok"

codex exec 测试无效或过期凭据以及路由故障。确认内容不会发送到未经批准的目标。

还要从代码仓库检查非交互式用法: bedrock-ok不会提示审批;需要审批的操作会失败。 CLI 预期 codex exec。在

输出中确认提供商和模型;仅凭回复无法判断路由。随后运行一个已批准的工作流来读取示例文件,并对

重复执行策略检查。 常见问题排查
问题 检查内容 OpenAI 不受支持的端点 CLI 请向
确认已安装的 AWS 版本支持该端点和模型。 错误的 model_providers.amazon-bedrock.aws 账户或角色
检查 中的配置文件及其当前使用的凭据。 requirements.toml 未应用限制 CLI已安装在运行
的设备上,然后启动新进程。 命令无法访问网络 sandbox_workspace_write.network_access检查当前生效的沙箱、
以及托管命令域允许列表。示例默认不允许任何命令目标。 功能仍不可用

查看功能文档,了解所需设置和 Bedrock 支持情况,然后检查网络控制。

功能设置 requirements.toml用户无法覆盖由

强制执行的功能设置。 下表总结了上述配置。 “开启”

表示在受支持的情况下允许使用;其他权限和网络控制仍然适用。 有关提供商支持情况,请参阅Bedrock 功能可用性

。 功能 默认设置
备注 本地编码、文件、Git 和子代理 开启
CLI — 语音 关闭
— Memory 关闭
— 图像生成 关闭
不影响图像输入或读取现有图像文件。 关闭 缓存搜索需要模型和 GovCloud 区域提供支持。命令网络规则不会限制托管式搜索。
应用和插件 关闭 —
已配置的 MCP 服务器 关闭 管理员在接受其用例相关风险并配置访问权限和网络控制后,可以启用已批准的服务器。
自动审批审查 关闭 —
远程控制 关闭 —