-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(bedrock-alpha): grant IAM permissions for all regions in geoRegion for CrossRegionInferenceProfile #36778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…erence profiles - Add RegionInfo import to dynamically determine regions for geographic areas - Store geoRegion as private property in CrossRegionInferenceProfile class - Implement getRegionsForGeoArea() method to map geoRegion to AWS region lists - Update grantProfileUsage() to generate ARNs for all regions in the geoRegion - Add comprehensive documentation explaining multi-region permission scope - Include warnings about data residency for APAC geoRegion (includes me-central-1) - Add detailed JSDoc comments explaining regional permission grants - Add test coverage for multi-region ARN generation across all geoRegion types - Support region filtering by partition (aws, aws-us-gov) and prefix matching - Ensure cross-region inference profiles grant permissions across all regions in configured geoRegion to support dynamic request routing
…ssions - Update grantProfileUsage documentation to reflect bedrock:InvokeModel* permissions instead of bedrock:ListInferenceProfiles - Add detailed explanation of cross-region permission scope across all regions within configured geoRegion - Include examples for US, EU, APAC, and GLOBAL geoRegions showing affected regions - Add compliance warning for users with strict regional requirements - Link to AWS documentation on geographic cross-region inference IAM setup - Clarify that permissions are granted dynamically based on geoRegion availability, not just deployment region
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
…-region permissions
…shots - Update BedrockInferenceProfilesTestDefaultTestDeployAssert4CC2EFAB.assets.json with new asset hashes - Update BedrockInferenceProfilesTestDefaultTestDeployAssert4CC2EFAB.template.json to remove CDK metadata - Update aws-cdk-bedrock-inference-profiles-integ.assets.json with refreshed asset references - Update aws-cdk-bedrock-inference-profiles-integ.template.json with latest CloudFormation template - Refresh cdk.out, integ.json, manifest.json, and tree.json snapshots - Regenerate snapshots to reflect current test state and CDK version alignment
…shots - Update integration test snapshot version from 45.0.0 to 48.0.0 - Regenerate template asset hashes to reflect current CloudFormation state - Add TestRole and TestRoleDefaultPolicy resources for cross-region inference profile permissions testing - Update inference profile resource ARNs to include multi-region support (us-east-1, us-east-2, us-west-1, us-west-2) - Regenerate manifest and tree.json snapshots to match updated test infrastructure
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
|
||||||||||||||
|
|
||||||||||||||
…card fallback - Remove wildcard fallback to enforce least-privilege principle - Add test to verify all enum values are supported by grantProfileUsage
…ace and interface-extends-ref rules
Issue # (if applicable)
Closes #36774.
Reason for this change
The
grantProfileUsage()method inCrossRegionInferenceProfileonly grants IAM permissions for the current region (Aws.REGION), but cross-region inference profiles dynamically route requests across multiple regions within a geoRegion. This causes Lambda functions to fail with "Your account is not authorized to invoke this API operation with a prompt resource" when the profile routes requests to regions other than the source region.Description of changes
Implemented the
RegionInfoapproach to grant IAM permissions for all regions within a geoRegion:RegionInfoimport fromaws-cdk-lib/region-infogeoRegionproperty to store the configured geographic areagetRegionsForGeoArea()helper method that returns the list of AWS regions for each geoRegiongrantProfileUsage()to generate multiple ARNs (one per region in the geoRegion)Describe any new or updated permissions being added
bedrock:GetInferenceProfileandbedrock:InvokeModel*actions are granted.Description of how you validated changes
grantProfileUsage()call to verify multi-region ARN generation in CloudFormation templatecross-region-inference-profile.test.tsSecurity considerations
Least-privilege enforcement: Unknown geoRegions now throw an error instead of falling back to wildcard
*permissions. This prevents silent over-permissioning if new geoRegions are added in the future without updating the region mappings.Region mapping approach: According to AWS documentation, the exact destination regions for a cross-region inference profile depend on both the specific model and the source region. For example,
us.anthropic.claude-3-haikufromus-east-2routes tous-east-1,us-east-2,us-west-2, but fromus-west-2only routes tous-east-1,us-west-2.Our implementation grants permissions to all regions in the geographic area (e.g., all
us-*regions for US geoRegion) rather than trying to predict exact routing. This is intentionally more permissive because:Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license