

Problem: Unrestricted Bedrock Access Creates Security and Governance Risks
Different users and applications will have different Bedrock needs. Typical Bedrock resources include foundation models, knowledge bases, and guardrails. Granting broad Bedrock permissions without constraints can lead to multiple risks:- Uncontrolled invocation of any model, including costly or sensitive models.
- Access to private or sensitive knowledge bases used for RAG.
- The ability to bypass guardrails if their use is not enforced.
- Inconsistent or unsafe usage patterns across your organization.

Solution: Use IAM to Apply Least Privilege for Bedrock
IAM is the recommended mechanism to:- Define who can call Bedrock APIs.
- Restrict which foundation models can be invoked.
- Limit RAG operations to specific knowledge bases.
- Enforce guardrail usage and prevent modification of approved guardrails.
- Apply the principle of least privilege so each principal gets only the permissions it needs.
Example IAM policy (comprehensive)
This policy demonstrates common controls:- Allow a single foundation model.
- Explicitly deny all other models.
- Allow RAG operations on a specific knowledge base.
- Allow applying one approved guardrail while denying any guardrail create/update/delete actions.
- The
AllowSpecificFoundationModelstatement grantsbedrock:InvokeModelonly for the specified Claude 3 Sonnet model. - The
DenyAllOtherModelsstatement usesNotResourceand an explicitDenyto prevent invocation of any other model — an explicitDenyalways overridesAllow. AllowSpecificKnowledgeBaselimits RAG operations (bedrock:Retrieve,bedrock:RetrieveAndGenerate) to a single knowledge base.- Combining
AllowSpecificGuardrailwithDenyGuardrailModificationpermits the application of a tested guardrail but prevents creating, editing, or deleting guardrails.
Always prefer narrowly scoped policies (by action and by resource) and use explicit Deny statements when you need to make sure a capability cannot be used.
Minimal IAM policy (focused example)
A smaller, focused policy that covers two common needs: allowing one model and permitting RAG against one knowledge base.IAM concepts for Bedrock — quick reference
- A policy
StatementcanAlloworDenyone or more actions and can be scoped withResourceorNotResource. - Use
bedrock:InvokeModelto grant or prevent generation from foundation models. - Use
bedrock:Retrieveandbedrock:RetrieveAndGenerateto control knowledge-base retrieval and RAG operations. - Use
bedrock:ApplyGuardrailto allow applying an approved guardrail; usebedrock:CreateGuardrail,bedrock:UpdateGuardrail, andbedrock:DeleteGuardrailto control guardrail lifecycle. - An explicit
Denyalways overridesAllow. UseDenyto enforce strict prohibitions.
Mapping common SDK calls to IAM actions
When using an AWS SDK, high-level methods map to Bedrock IAM actions. Test policies by attaching them to a representative principal (role or user) and validating allowed and denied behaviors.
Note: Both
InvokeModel and Converse map to the same underlying IAM action (bedrock:InvokeModel). Controlling bedrock:InvokeModel in a policy will affect both SDK methods.
Recommended testing and next steps
- Attach example policies to test roles and users in a sandbox account.
- Verify allowed operations succeed and that explicit Deny statements prevent the prohibited actions.
- For stricter enforcement, combine resource-level restrictions with IAM policy conditions (future content will cover forcing guardrail usage via request attributes and additional policy condition examples).
- Document which principals require access to which foundation models and knowledge bases — then codify those requirements into least-privilege IAM policies.