When I use an inference profile in an AWS Organizations account to invoke a foundation model across AWS Regions in Amazon Bedrock, I get the "AccessDeniedException" error.
Short description
The "AccessDeniedException" error occurs when your AWS Identity and Access Management (IAM) role doesn't have the permission to invoke the API request in the destination Regions. Your AWS account that's a member of AWS Organizations might have a service control policy (SCP) that restricts access to Amazon Bedrock services. To resolve this issue, modify the IAM policy permissions.
Resolution
Prerequisite: Request model access from your source Region.
Modify the IAM policy
Update your SCP to include one of the following example policy statements.
Note: In the following policy statements, replace aa-example-1, aa-example-2, aa-example-3 with your Regions.
Deny access to AWS services and resources from specified Regions except for Amazon Bedrock:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"NotAction": "bedrock:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": [
"aa-example-1",
"aa-example-2",
"aa-example-3"
]
}
}
}
]
}
Deny actions to invoke a foundation model except through the inference profile in the specified Regions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:*::foundation-model/*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": [
"aa-example-1",
"aa-example-2",
"aa-example-3"
]
},
"ArnNotLike": {
"bedrock:InferenceProfileArn": [
"arn:aws:bedrock:*:*:application-inference-profile/*",
"arn:aws:bedrock:*:*:inference-profile/*"
]
}
}
}
]
}
Related information
Identity-based policy examples for Amazon Bedrock
Prerequisites for inference profiles
Implementing least privilege access for Amazon Bedrock
Enable Amazon Bedrock cross-Region inference in multi-account environments