Join our Newsletter — 33% off our NHI Course
Home› Guides› Amazon Bedrock Security Guide: Securing Models, Agents and…
Guide AI Platforms

Amazon Bedrock Security Guide: Securing Models, Agents and Knowledge Bases

PDF for newsletter subscribers · free to read online

← All guides
By Lalit Choda, NHI Mgmt Group Updated 24 October 2026 16 min read
On this page

Any AWS principal that can call bedrock:InvokeModel can spend money, read whatever an agent or knowledge base can reach, and, by default, leave no record of what it asked. Amazon Bedrock is governed by ordinary IAM, but it adds its own moving parts: service roles that agents and knowledge bases assume, a bearer-token API key type, guardrails that only apply when a request names them, and model access that switches itself on at first use. This guide explains how identity and access work across Bedrock models, Agents, AgentCore and Knowledge Bases, which settings to change first, and what to log and alert on. It is for cloud security engineers and AI platform owners. General AWS account controls are covered in the AWS Security Guide and policy mechanics in the AWS IAM Policies and Roles Guide; this page stays on what is specific to Bedrock.

Key takeaways

  • Model access is not an entitlement gate any more. Most serverless models enable on first invocation, so the only reliable control is an explicit deny on bedrock:InvokeModel (SCP or IAM) for models you have not approved.
  • Agents and knowledge bases act through their own roles. Their service roles decide what data and tools a prompt can reach, so scope them to specific resources and protect the trust policy with aws:SourceAccount and aws:SourceArn.
  • Guardrails are opt-in per request. Use the bedrock:GuardrailIdentifier condition key, or account and organisation enforced guardrails, to make them mandatory rather than advisory.
  • Prompt logging is off by default. Turn on model invocation logging and the CloudTrail data events for agents, knowledge bases and guardrails, and alert when anyone reads or changes the logging configuration.
  • Bedrock API keys are credentials, not configuration. Block long-term keys with bedrock:bearerTokenType, cap their age, and prefer roles and short-term keys in production.

How identity and access work in Amazon Bedrock

Actions use the bedrock: prefix (and bedrock-mantle: for the Mantle endpoint), resources are ARNs such as arn:aws:bedrock:region::foundation-model/model-id, ...:agent/AGENT-ID and ...:knowledge-base/KB-ID, and ABAC works through aws:ResourceTag, aws:RequestTag and aws:TagKeys. Bedrock supports resource-based policies only for guardrails and guardrail inference profiles, and it uses service roles but no service-linked roles. Some actions touch several resources at once: AssociateAgentKnowledgeBase needs permission on both the agent and the knowledge base.

IdentityWhat it is in BedrockMain riskPrimary control
Human users and adminsFederated roles calling the console, bedrock and bedrock-agent APIsBroad bedrock:* grants that include model enablement, logging changes and agent editsSeparate builder, operator and logging-admin roles; deny logging changes outside the security role
Application rolesLambda, ECS, EKS or EC2 roles calling bedrock-runtimeInvoke on foundation-model/*, any RegionAllow only approved model ARNs and inference profiles; require a guardrail
Agent service roleRole Bedrock assumes to run an agentReaching every bucket, knowledge base and model in the accountTrust policy pinned to agent IDs; resource-scoped InvokeModel, s3:GetObject and Retrieve
Knowledge base service roleRole Bedrock assumes to ingest and embed dataReading more source data than the use case needsBucket and prefix scoping with aws:ResourceAccount; KMS kms:ViaService conditions
Action group Lambda functionsTools an agent callsFunction role with write access to production systemsResource-based policy limited to the agent ARN; least privilege on the function role
Bedrock API keysBearer tokens, short-term or long-term (an IAM user with a service-specific credential)Leaked token used from anywhere until expiryDeny bedrock:CallWithBearerToken or allow only SHORT_TERM
AgentCore workload identitiesAgent identities in the AgentCore Identity directoryOutbound OAuth tokens and API keys used beyond their purposeToken vault, scoped credential providers, inbound JWT authorizers

Model access and entitlements

Bedrock no longer uses a manual model-access request for most serverless models. The first InvokeModel or Converse call to a third-party model starts an AWS Marketplace subscription in the background, which needs aws-marketplace:Subscribe, aws-marketplace:Unsubscribe and aws-marketplace:ViewSubscriptions on the caller, plus a one-time Anthropic use case form (PutUseCaseForModelAccess) for Anthropic models. Four consequences matter for security:

  • Deny Subscribe is not enough: AWS documents that denying aws-marketplace:Subscribe does not stop the first invocation. Block unapproved models with a deny on bedrock:InvokeModel for their foundation-model ARNs, ideally as an SCP. See the AWS Organizations and SCPs Guide.
  • Subscriptions cross Regions: a subscription in one Region makes the model available in every supported Region, so Region-restriction SCPs must cover Bedrock too.
  • Agreement deletion is not revocation: deleting an agreement does not block access because the next invocation recreates it. Pair it with a deny.
  • The first call accepts the EULA: block first if licence terms need review.

Admin roles and privileged access

In Bedrock the privileged actions are not only IAM changes. A small set of API calls changes what is logged, which models exist in the account, what an agent can do and which data a knowledge base exposes. Treat the principals that hold them as privileged and put them behind just-in-time elevation. See the Cloud PAM and CIEM Guide.

Privileged actionWhy it is sensitiveWho should hold it
PutModelInvocationLoggingConfiguration, DeleteModelInvocationLoggingConfigurationTurns prompt and response logging off or redirects itSecurity logging role only; deny everyone else by SCP
PutUseCaseForModelAccess, CreateFoundationModelAgreement, aws-marketplace:SubscribeEnables new models and accepts terms; used in LLMjacking campaignsPlatform team, through change control
CreateAgent, UpdateAgent, action group and alias changesChanges tools, instructions and the role an agent usesAgent builders in non-production; pipeline role in production
CreateDataSource, UpdateDataSource, StartIngestionJobThese do not pass a role, so anyone who can manage a data source can ingest whatever the knowledge base role can read, then query itData owners and the deployment pipeline
Guardrail create, update, delete and resource policy changesWeakens or removes the safety layer for every caller that relies on itAI governance or security team
iam:PassRole for Bedrock service rolesLets a builder attach a more powerful role to an agent or jobScoped to named Bedrock roles with iam:PassedToService
iam:CreateServiceSpecificCredentialCreates long-term Bedrock API keysNobody in production; cap with iam:ServiceSpecificCredentialAgeDays elsewhere

Keep the broad managed AmazonBedrockFullAccess policy out of production application and builder roles; write scoped policies following the AWS IAM Policies and Roles Guide.

Integrations, API tokens and service accounts

Bedrock API keys

  • Short-term keys: last up to 12 hours (or the session length if shorter) and inherit the permissions of the principal that generated them.
  • Long-term keys: create an IAM user with a service-specific credential, work only in the Region where they were generated, and last until a configured expiry. AWS positions them for exploration. Treat them as static secrets. See the LLMjacking Guide.
  • Controls: deny bedrock:CallWithBearerToken (and bedrock-mantle:CallWithBearerToken) where keys are not needed, or allow only bedrock:bearerTokenType = SHORT_TERM. Long-term keys are deactivated, reset or deleted through the service-specific credential APIs; a short-term key is killed by invalidating its session or denying CallWithBearerToken.
  • Logging: calls made with keys appear in CloudTrail, but the key itself is not logged, so attribute activity by principal ARN.

Agent service roles and action groups

  • Trust policy: allow bedrock.amazonaws.com to assume the role only with aws:SourceAccount set to your account and AWS:SourceArn matching the agent ARN. AWS advises replacing the agent/* wildcard with specific agent IDs once they exist; this is the confused-deputy protection.
  • Permissions: bedrock:InvokeModel on the orchestration model (plus inference profile actions if used), s3:GetObject on the OpenAPI schema object only, bedrock:Retrieve on associated knowledge bases, bedrock:ApplyGuardrail on the guardrail, and bedrock:InvokeAgent only on named collaborator aliases for multi-agent setups.
  • Lambda tools: each action group function needs a resource-based policy allowing lambda:InvokeFunction from bedrock.amazonaws.com, scoped by the same source conditions. The function's own execution role is where real-world write access lives, so review it as a non-human identity. See the Serverless Security Guide.
  • User confirmation: for actions that change state, enable user confirmation on the action. The agent then returns control to the application with the planned call, and the action runs only after a CONFIRM. AWS notes that agents can follow instructions embedded in API or knowledge base responses, which is exactly the excessive agency risk in OWASP LLM06:2025. See the Agentic AI Security Guide.

Knowledge base roles

The knowledge base role needs bedrock:InvokeModel on the embedding model, s3:ListBucket and s3:GetObject on the source (conditioned on aws:ResourceAccount), aoss:APIAccessAll on the OpenSearch Serverless collection, and secretsmanager:GetSecretValue only for third-party vector stores. Scope S3 to the exact prefixes, because everything the role can read becomes retrievable by anyone with bedrock:Retrieve on that knowledge base. IAM grants Retrieve per knowledge base, not per document: separate data with different classification levels into separate knowledge bases, and control Retrieve and RetrieveAndGenerate per caller.

AgentCore Identity

AgentCore hosts agents and tools through services including Runtime, Gateway (APIs and Lambda functions exposed as MCP-compatible tools), Memory and Policy. AgentCore Identity gives each agent a workload identity in a directory (ARN form arn:aws:bedrock-agentcore:region:account:workload-identity/directory/default/workload-identity/agent-name), supports inbound JWT authorizers, and keeps outbound OAuth 2.0 tokens, client credentials and API keys in a token vault encrypted with AWS KMS. Credential providers support machine-to-machine (2LO, client credentials) and user-delegated (3LO, authorization code) flows. Prefer 3LO where the agent acts for a user, scope 2LO credentials per tool, and review Gateway targets as tool permissions. See the MCP Security Guide and the Agentic AI Identity Guide.

Choosing a credential pattern

CallerUseAvoid
Workload in AWS (Lambda, ECS, EKS, EC2)Its IAM role with SigV4Any API key
Workload outside AWSIAM Roles Anywhere or OIDC federation to a role. See the Cloud Workload Identity GuideIAM user access keys, long-term Bedrock keys
Tool that only accepts a bearer tokenShort-term Bedrock API key refreshed by the token generatorLong-term key in an environment file
Developer experimentation in a sandbox accountLong-term key with a short age limit, sandbox SCP and budgetKeys created in production accounts
Agent calling third-party SaaSAgentCore Identity credential provider with 3LO where a user is presentShared admin API key embedded in agent code

For small teams with one or two Bedrock applications, application roles, a mandatory guardrail and invocation logging cover most of the risk. Large organisations with many accounts should add the SCP model allow-list, organisation-level guardrail enforcement and central log aggregation, and run agents through a pipeline role rather than console edits.

Logging and detection

Two logs are needed and they record different things. CloudTrail records who called which API; model invocation logging records the prompts and responses.

SourceWhat it recordsDefaultSetting
CloudTrail management eventsInvokeModel, InvokeModelWithResponseStream, Converse, ConverseStream and all control plane calls such as CreateAgentOn in trailsOrganisation trail; filter on eventType = AwsApiCall when counting streamed calls
CloudTrail data eventsInvokeAgent (AWS::Bedrock::AgentAlias), InvokeInlineAgent, Retrieve and RetrieveAndGenerate (AWS::Bedrock::KnowledgeBase), InvokeFlow, ApplyGuardrail (AWS::Bedrock::Guardrail), async invokesOffAdvanced event selectors per resource type; extra cost
Model invocation loggingRequest and response bodies, modelId, identity.arn, requestMetadata, input and output token counts for text, image, embedding and videoOffS3 and/or CloudWatch Logs in the same account and Region; bodies over 100 KB go to S3

Two gaps to plan for: invocation logging captures calls through the bedrock-runtime endpoint only and does not currently capture bedrock-mantle,, and the logs contain the prompts themselves: encrypt the destination with a customer managed KMS key and restrict reads to an investigations role.

Detections worth building

  • Logging tampering: any GetModelInvocationLoggingConfiguration, PutModelInvocationLoggingConfiguration or DeleteModelInvocationLoggingConfiguration outside the security role. Attackers in the LLMjacking campaigns queried the logging configuration before using stolen keys. This maps to ATT&CK T1685 Disable or Modify Tools.
  • First-time model enablement: PutUseCaseForModelAccess, CreateFoundationModelAgreement or a new modelId for a principal, which researchers saw attackers call before invoking models.
  • Invocation anomalies: token volume per principal well above baseline, invocations from new Regions or source IPs and principals with no Bedrock history (ATT&CK T1496.004 Cloud Service Hijacking, ATLAS AML.T0034 Cost Harvesting).
  • Agent and data changes: UpdateAgent, new data sources and ingestion jobs outside the pipeline role.
  • Guardrail hits: spikes in prompt attack or sensitive information interventions per application, which signal probing (ATLAS AML.T0051 LLM Prompt Injection).
  • Key creation: CreateServiceSpecificCredential for Bedrock in any production account.

Metrics

  • Percentage of accounts using Bedrock with invocation logging enabled (target 100).
  • Percentage of production inference roles that carry a bedrock:GuardrailIdentifier condition or are covered by an enforced guardrail.
  • Number of active long-term Bedrock API keys, and maximum key age.
  • Agent and knowledge base service roles with wildcard trust or wildcard S3 resources (target 0).
  • Bedrock spend per principal against budget, and time from anomaly alert to key or session revocation.

Hardening baseline

AreaBaseline setting
Model allow-listSCP denying bedrock:InvokeModel (which also governs Converse) except approved foundation-model and inference profile ARNs, and Regions
GuardrailsContent filters including Prompt Attack, denied topics, sensitive information filters (block or mask PII, custom regex), contextual grounding checks for RAG; versioned, not DRAFT, in production
Guardrail enforcementAllow plus explicit Deny on bedrock:GuardrailIdentifier for direct inference roles; account or organisation enforced guardrails, which need a guardrail resource-based policy
NetworkInterface endpoints for bedrock-runtime, bedrock-agent-runtime and others used, with an endpoint policy narrower than the default full access; aws:SourceVpce conditions on application roles; VPC config for customisation and batch jobs
EncryptionCustomer managed keys for agents (customerEncryptionKeyArn), custom models (customModelKmsKeyId), knowledge base ingestion (kmsKeyArn), vector stores, evaluation jobs and log destinations
API keysDeny CallWithBearerToken or allow SHORT_TERM only; cap long-term key age
Service rolesOne role per agent or knowledge base, source conditions pinned to the resource ID, no shared policies
AgentsGuardrail associated, user confirmation on state-changing actions, clear system prompt stating scope, pre-processing prompt where suitable

Two documented caveats: guardrail input tags let a caller exclude parts of the prompt from evaluation (the response is still checked), and a role restricted with bedrock:GuardrailIdentifier will get access denied on InvokeAgent and RetrieveAndGenerate, because those make internal model calls without the guardrail; give agent and RAG callers separate roles and associate the guardrail with the agent instead. See the AI Guardrails and AI Firewalls Guide and the Prompt Injection Guide.

Rolling it out

  1. Inventory: list accounts and Regions with Bedrock CloudTrail activity, the models invoked, the principals calling them, every agent, knowledge base and guardrail, and any service-specific credentials.
  2. Turn on visibility first: enable invocation logging and data event selectors, and deploy the logging-tamper and model-enablement alerts.
  3. Audit before you deny: run the model allow-list and API key SCPs against two weeks of CloudTrail to find callers that would break; use IAM Access Analyzer policy generation to draft least-privilege application policies.
  4. Pilot: apply SCPs to a sandbox OU, then one production OU; apply guardrail enforcement to one application role.
  5. Tighten service roles: replace wildcard source ARNs with agent and knowledge base IDs, and split shared roles.
  6. Roll back: keep each SCP as a separate policy so it can be detached quickly, and revert guardrails to the previous version.

Framework mapping

Control areaNIST SP 800-53 Rev. 5NIST CSF 2.0Threat reference
Model and role least privilegeAC-6, AC-3PR.AA-05OWASP LLM06:2025 Excessive Agency
API keys and service credentialsIA-5, AC-2PR.AA-01ATT&CK T1552.001, T1078.004
Invocation logging and CloudTrailAU-2, AU-12PR.PS-04, DE.CM-09ATT&CK T1685
Spend and abuse monitoringAU-12DE.CM-09ATT&CK T1496.004; ATLAS AML.T0034; OWASP LLM10:2025
Guardrails and input handlingAC-3PR.AA-05ATLAS AML.T0051; OWASP LLM01:2025
Private endpointsSC-7PR.IR-01ATLAS AML.T0040
Encryption of agents, models, logsSC-12, SC-28PR.AA-01OWASP LLM02:2025

Common misconfigurations

  • Relying on denied Marketplace subscriptions: teams deny aws-marketplace:Subscribe and assume models are blocked, but first-use invocation still enables them. Deny the invoke.
  • Logging never enabled: invocation logging is off by default, so incident responders have token bills but no prompts. In the LLMjacking campaigns stolen AWS credentials were used to run Bedrock models at the victim's expense, and attackers checked logging before starting.
  • Wildcard service role trust: trust policies left at agent/* or knowledge-base/*, or one role shared by every agent, so any new agent inherits all data access.
  • Static keys for convenience: long-term Bedrock keys or IAM user access keys in notebooks and environment files. Leaked AWS keys are tested within minutes; the AWS crypto-mining campaign shows how fast stolen IAM credentials are used.
  • Guardrail named in code, not in policy: a developer removes the guardrail parameter and nothing fails. Enforce with the condition key or enforced guardrails.
  • One knowledge base for all documents: HR, finance and public content ingested together, so every caller of Retrieve can reach all of it, and data source managers can add any bucket the role can read.

Practitioner checklist

  • Enable model invocation logging and CloudTrail data events for agent aliases, knowledge bases and guardrails in every Bedrock account and Region.
  • Alert on any read or change of the invocation logging configuration and on model enablement calls.
  • Deploy an SCP allow-list for approved model ARNs and Regions; do not rely on Marketplace denies.
  • Block or restrict Bedrock API keys with bedrock:CallWithBearerToken and bedrock:bearerTokenType, and cap long-term key age.
  • Pin every agent and knowledge base service role trust policy to the specific resource ID with aws:SourceAccount and aws:SourceArn.
  • Scope knowledge base roles to exact S3 prefixes and split knowledge bases by data classification.
  • Make guardrails mandatory through bedrock:GuardrailIdentifier or enforced guardrails, using versioned guardrails in production.
  • Enable user confirmation on agent actions that change data or send messages.
  • Use interface endpoints with restrictive endpoint policies, customer managed KMS keys, and Bedrock spend alarms per account.

Standards and references

Related NHI Mgmt Group resources: AWS Security Guide · AWS IAM Policies and Roles Guide · LLMjacking Guide · AI Security Posture Management (AI-SPM) Guide · MITRE ATLAS Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Written and reviewed by Lalit Choda, NHI Mgmt Group. Last updated 24 October 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.