- EC2 instances (via an instance profile),
- Lambda functions (as an execution role),
- ECS tasks/containers (as a task role).
InvokeModel or RetrieveAndGenerate), whether the call succeeds depends on the permissions granted to the IAM role attached to the compute environment.
We must also consider actions Bedrock might perform on our behalf. For example, when using Retrieve and Generate (RAG), Bedrock may need to access your S3 objects or query/ingest vectors in a vector store. For those operations, Bedrock itself needs a service role with policies that grant access to the underlying resources (S3, OpenSearch, Lambda, etc.). You explicitly configure this service role when setting up the integration so Bedrock can perform those tasks on your behalf.

App authentication and authorization (SDK usage)
If you call Bedrock from an environment outside AWS, you might provide an access key and secret in your client configuration. Instead, when your code runs inside AWS, attach an IAM role to the compute resource (EC2 instance profile, Lambda execution role, or ECS task role). The AWS SDK automatically uses the temporary credentials (access key, secret key, and session token) provided by the role. These temporary credentials are rotated and refreshed automatically, reducing the risk compared to long‑lived credentials.
Prefer attaching an IAM role to your compute resource (instance profile, execution role, or task role) so the SDK uses temporary credentials that are rotated automatically.

bedrock:InvokeModel for that specific model ARN and attach it to the role used by your compute resource. Everything else should be implicitly denied.
Remember:
- IAM enforces an implicit deny: if a permission is not explicitly allowed, it is denied.
- Explicit Deny statements take precedence over Allows. If you must ensure certain actions can never be performed by a role, add an explicit Deny.
Avoid wildcard permissions like
bedrock:*. Wildcards can grant far more access than intended (e.g., creating agents, spinning up Marketplace deployments, or accessing training data). Use explicit actions and resource ARNs.- Do not grant access to models or features your application will not use — e.g., don’t grant AgentCore or agent creation if unnecessary.
- Knowledge integrations can expose sensitive organization data. Grant access only to principals that legitimately need to search or retrieve that data.
- Scope permissions to the specific AWS Region(s) where your application runs. If your app runs only in
eu-west-3(Paris), do not grant Bedrock permissions in other Regions likeus-east-1orap-southeast-1.
- Use the visual policy builder (checkbox UI that generates JSON).
- Write the JSON policy directly — knowing the JSON is valuable for troubleshooting and precise scoping.

- Allows invoking a specific foundation model (Claude 3 Sonnet) using
bedrock:InvokeModel. - Allows Bedrock RAG calls for a specific knowledge base using
bedrock:RetrieveAndGenerate.
Action or overly broad resource ARNs in production.
Quick checklist for production-ready Bedrock policies
Summary
- Attach policies to IAM roles for compute resources (EC2/Lambda/ECS) rather than embedding long‑lived credentials.
- Provide Bedrock a custom service role when it must act on your behalf (knowledge bases, agents).
- Follow the principle of least privilege: allow only the actions and resources your application needs, scoped to the required Region(s).
- Prefer custom, narrowly scoped policies instead of Amazon‑managed or wildcard policies for production.
- Amazon Bedrock documentation
- IAM user guide — policies and permissions
- Learn more about RAG: https://learn.kodekloud.com/user/courses/fundamentals-of-rag