面向安全团队的决策指南:用 SCP、IAM 和 VPC Endpoint 三层策略,让 Bedrock 模型只能从指定的出口 IP 和 VPC Endpoint 调用,并配好审计与告警。
来源限制写在调用方的权限策略里,三层配合,覆盖两个推理入口和两种认证方式。
组织内所有账号只能从指定的出口 IP 或指定的 VPC Endpoint 调用模型。
每个应用角色只能调用自己需要的模型。
AWS 内的工作负载走私网访问,用 Endpoint 策略限定身份和模型。
bedrock-runtime 和 bedrock-mantle(OpenAI / Anthropic 兼容接口),对应权限分别是 bedrock:InvokeModel* 和 bedrock-mantle:CreateInference。AWS::BedrockMantle::Project)。runtime 的调用默认记录在管理事件中。| 风险 | 场景 |
|---|---|
| 凭证外泄后被异地使用 | AK/SK、STS 临时凭证或 Bedrock API Key 出现在代码仓库、日志或员工电脑上,攻击者从任意 IP 调用模型,产生费用或导出数据 |
| 绕开受控出口 | 员工或应用绕过公司代理、网关,从其他网络直接调用 |
| 借托管功能间接调用 | 通过 Bedrock Agent、Knowledge Base 等托管功能调用模型 |
本文覆盖的问题是:谁能从哪里调用模型。
| bedrock-runtime | bedrock-mantle | |
|---|---|---|
| 地址 | bedrock-runtime.<region>.amazonaws.com | bedrock-mantle.<region>.api.aws |
| 包含的 API | InvokeModel、Converse、ConverseStream、OpenAI 兼容的 Chat Completions / Responses | OpenAI 兼容:/openai/v1/chat/completions/openai/v1/responsesAnthropic 兼容: /anthropic/v1/messages |
| 授权用的权限 | bedrock:InvokeModelbedrock:InvokeModelWithResponseStream | bedrock-mantle:CreateInference |
| 按模型限制 | 在 Resource 中写模型或推理配置文件(inference profile)的 ARN | 用条件键 bedrock-mantle:Model;资源为 project/default |
us.、global. 前缀),配置文件 ARN 和底层模型 ARN 要一起授权。底层模型 ARN 的 region 写 *,以覆盖跨 region 路由。| 方式 | 说明 | 来源控制 |
|---|---|---|
| SigV4 签名 | 标准 AWS 凭证(IAM 角色、用户),推荐使用 | 适用第 05 节的全部条件 |
| Bedrock API Key | Authorization: Bearer ...。短期 Key 由现有凭证派生,长期 Key 绑定在 IAM 用户上 | 适用第 05 节的全部条件;两个入口分别用 bedrock:CallWithBearerToken 和 bedrock-mantle:CallWithBearerToken 控制 |
| 调用方位置 | 做法 |
|---|---|
| AWS 内 EC2、ECS、EKS、VPC 内的 Lambda | 建 bedrock-runtime 和 bedrock-mantle 两个接口型 VPC Endpoint;SCP 只放行来自这两个 Endpoint 的调用;Endpoint 策略限定角色和模型 |
| 公司 IDC 或其他云 | 用 NAT 或代理固定公网出口 IP;SCP 只放行来自这些 IP 的调用;通过 IAM Roles Anywhere 获取临时凭证 |
| 两者都有 | 出口 IP 和 VPC Endpoint 写在同一条策略里,见 05 · 公网与私网并存时的写法 |
| 员工本机、开发调试 | 统一走公司代理或 VPN 出口,并把出口 IP 加入白名单 |
aws:SourceIp)NotIpAddress aws:SourceIp。com.amazonaws.<region>.bedrock-runtime 和 com.amazonaws.<region>.bedrock-mantle。| 条件键 | 含义 | 用法 |
|---|---|---|
aws:SourceVpce | 请求经过的 Endpoint ID | 首选,精确到具体 Endpoint |
aws:SourceVpc | 请求来自的 VPC | VPC 内 Endpoint 较多时用它简化 |
aws:VpcSourceIp | 客户端在 VPC 内的私网 IP | 进一步限定到子网或主机 |
Mantle Endpoint 支持双栈,双栈子网里的客户端默认通过 IPv6 访问它。用 aws:VpcSourceIp 做白名单时,要把 VPC 的 IPv4 段和 IPv6 段一起写进去。
在 VPC Endpoint 策略中做第二道限定:
Resource 中,Mantle 用 bedrock-mantle:Model 条件;IP 条件和 Endpoint 条件写在同一条 Deny 语句里。来自白名单 IP 或白名单 Endpoint 的请求放行,其余请求被拒:
"Condition": {
"NotIpAddress": { "aws:SourceIp": ["203.0.113.10/32"] },
"StringNotEquals": { "aws:SourceVpce": ["vpce-0123456789abcdef0", "vpce-0fedcba9876543210"] }
}
| 目标 | 做法 |
|---|---|
| 整体禁用 | 在 SCP 中 Deny bedrock:CallWithBearerToken 和 bedrock-mantle:CallWithBearerToken,两项都要写 |
| 只保留短期 Key | 对两个入口分别 Deny 长期 Key,条件为 bedrock:BearerTokenType = LONG_TERM 和 bedrock-mantle:BearerTokenType = LONG_TERM |
| 禁止创建长期 Key | Deny iam:CreateServiceSpecificCredential,条件为 iam:ServiceSpecificCredentialServiceName = bedrock.amazonaws.com |
| 清理存量 | 盘点已有的长期 Key 并删除 |
在来源限制之上,再限定每个角色能用哪些模型,以缩小凭证外泄后的影响范围:
Resource 中只列出允许的模型和推理配置文件。bedrock-mantle:Model 列出允许的模型名,例如 openai.gpt-5.6-luna、anthropic.claude-haiku-4-5。模型名与请求中的 model 字段完全一致。bedrock:InferenceProfileArn 条件。| 层 | 作用范围 | 承担的职责 | 配置要点 |
|---|---|---|---|
| SCP | 组织内成员账号的所有身份 | 网络来源兜底、API Key 管控、长期 Key 创建管控 | 作用于成员账号;业务全部放在成员账号,管理账号只做组织管理 |
| IAM 身份策略 / Permissions Boundary | 单个角色或用户 | 按应用限定模型 | 与 SCP 配合使用 |
| VPC Endpoint 策略 | 经过该 Endpoint 的请求 | 限定 Endpoint 上可用的身份和模型 | 公网路径由 SCP 控制 |
在 SCP 条件中用 ArnNotLike aws:PrincipalArn 给它留出例外,并对它的每次使用告警。
bedrock:InvokeModel、bedrock:InvokeModelWithResponseStream、bedrock-mantle:CreateInference。aws:VpcSourceIp 同时包含 VPC 的 IPv4 段和 IPv6 段。bedrock:CallWithBearerToken 和 bedrock-mantle:CallWithBearerToken 都已配置。*。| 入口 | 记录方式 | 事件名 |
|---|---|---|
| runtime | 默认记录为管理事件。另外开启数据事件 AWS::Bedrock::Model 后,同一次调用会再记一条数据事件 | Converse、ConverseStream、InvokeModel、InvokeModelWithResponseStream、ChatCompletions、Responses |
| Mantle | 开启数据事件 AWS::BedrockMantle::Project 后记录 | CreateInference |
成功的请求和被拒的请求都会记录。runtime 同时开启了管理事件和数据事件时,统计调用量要按 requestID 去重。
| 关注点 | 字段 |
|---|---|
| 请求来源 | sourceIPAddress:公网调用时是公网 IP,经 Endpoint 时是私网 IP(可能是 IPv6) |
| 是否经过 VPC Endpoint | vpcEndpointId |
| 使用的模型 | runtime:requestParameters.modelId;Mantle:requestParameters.model |
| 是否使用 API Key | runtime:additionalEventData.callWithBearerToken;Mantle:requestParameters.callWithBearerToken |
| 是否被拒 | errorCode:runtime 为 AccessDenied,Mantle 为 permission_denied_error |
| 是否由 AWS 服务代为调用 | sourceIPAddress 和 userIdentity.invokedBy 为 bedrock.amazonaws.com |
sourceIPAddress 在白名单之外,且 vpcEndpointId 为空:发现从非预期来源发起的调用尝试。AccessDenied 和 permission_denied_error。callWithBearerToken = true:适用于已禁用 API Key 的组织。CreateServiceSpecificCredential 且服务为 bedrock.amazonaws.com。CloudTrail Lake 查询示例(找出白名单之外的推理来源):
SELECT eventTime, eventSource, eventName, sourceIPAddress, vpcEndpointId,
userIdentity.arn, errorCode
FROM <event_data_store_id>
WHERE eventSource IN ('bedrock.amazonaws.com', 'bedrock-mantle.amazonaws.com')
AND eventName IN ('Converse','ConverseStream','InvokeModel','InvokeModelWithResponseStream',
'ChatCompletions','Responses','CreateInference')
AND vpcEndpointId IS NULL
AND sourceIPAddress NOT IN ('203.0.113.10', 'bedrock.amazonaws.com')
AND eventTime > '2026-11-01 00:00:00'
ORDER BY eventTime DESC
aws:PrincipalArn 只圈定测试角色。按需删减,<...> 替换为实际值。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyBedrockInferenceFromUnexpectedNetwork",
"Effect": "Deny",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock-mantle:CreateInference"
],
"Resource": "*",
"Condition": {
"NotIpAddress": { "aws:SourceIp": ["<出口IP/32>"] },
"StringNotEquals": { "aws:SourceVpce": ["<vpce-runtime>", "<vpce-mantle>"] },
"ArnNotLike": { "aws:PrincipalArn": "arn:aws:iam::*:role/<break-glass-role>" }
}
},
{
"Sid": "DenyBedrockApiKeys",
"Effect": "Deny",
"Action": [
"bedrock:CallWithBearerToken",
"bedrock-mantle:CallWithBearerToken"
],
"Resource": "*"
},
{
"Sid": "DenyCreatingLongTermBedrockApiKeys",
"Effect": "Deny",
"Action": "iam:CreateServiceSpecificCredential",
"Resource": "*",
"Condition": {
"StringEquals": { "iam:ServiceSpecificCredentialServiceName": "bedrock.amazonaws.com" }
}
}
]
}
bedrock:InvokeAgent、bedrock:InvokeInlineAgent、bedrock:RetrieveAndGenerate、bedrock:InvokeFlow 等权限加入第一条语句的 Action,条件保持不变。{
"Sid": "DenyLongTermApiKeysRuntime",
"Effect": "Deny",
"Action": "bedrock:CallWithBearerToken",
"Resource": "*",
"Condition": { "StringEquals": { "bedrock:BearerTokenType": "LONG_TERM" } }
},
{
"Sid": "DenyLongTermApiKeysMantle",
"Effect": "Deny",
"Action": "bedrock-mantle:CallWithBearerToken",
"Resource": "*",
"Condition": { "StringEquals": { "bedrock-mantle:BearerTokenType": "LONG_TERM" } }
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "RuntimeViaInferenceProfile",
"Effect": "Allow",
"Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
"Resource": [
"arn:aws:bedrock:*:<account>:inference-profile/us.anthropic.claude-haiku-4-5-*",
"arn:aws:bedrock:*::foundation-model/anthropic.claude-haiku-4-5-*"
]
},
{
"Sid": "RuntimeDirectModel",
"Effect": "Allow",
"Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
"Resource": "arn:aws:bedrock:<region>::foundation-model/moonshotai.kimi-k2.5"
},
{
"Sid": "MantleAllowedModels",
"Effect": "Allow",
"Action": "bedrock-mantle:CreateInference",
"Resource": "arn:aws:bedrock-mantle:*:<account>:project/*",
"Condition": {
"StringEquals": { "bedrock-mantle:Model": ["anthropic.claude-haiku-4-5", "openai.gpt-5.6-luna"] }
}
}
]
}
{
"Statement": [{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::<account>:role/<app-role>" },
"Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
"Resource": [
"arn:aws:bedrock:*::foundation-model/<allowed-model>",
"arn:aws:bedrock:*:<account>:inference-profile/<allowed-profile>"
]
}]
}
{
"Statement": [{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::<account>:role/<app-role>" },
"Action": "bedrock-mantle:CreateInference",
"Resource": "*",
"Condition": { "StringEquals": { "bedrock-mantle:Model": ["<allowed-model>"] } }
}]
}