← Blog

Bind Every Bedrock Batch Job to an Approved Service Role

Parminder Singh
Parminder Singh··6 min read
Summarize with AI

Amazon Bedrock CreateModelInvocationJob requires a service-role ARN that Bedrock assumes for batch inference. Production gateways should resolve that role from trusted route policy, verify its account and exact ARN, bind it to approved S3, KMS, model, and VPC settings, and retain the role plus job ARN as evidence instead of accepting a caller-selected execution identity.

Platform & Architectureai-securitycloud-securityidentity-and-authorizationpolicy-enforcementarchitectureaudit
Bind Every Bedrock Batch Job to an Approved Service Role

Amazon Bedrock CreateModelInvocationJob requires roleArn. Bedrock assumes that service role to read batch input and write output. It also uses optional resources configured for the job. A caller-controlled role ARN therefore changes the execution identity behind the same HTTP operation. Production code should resolve the role from trusted route policy and reject substitutions before the request leaves the gateway.

I would never expose roleArn as a free-form field in a public batch-job API. That is an authorization decision disguised as configuration.

TL;DR

  • Resolve the Bedrock batch service-role ARN on the server after caller authentication and route authorization.
  • Match the complete role ARN and approved path against the versioned route manifest. Verify the AWS account and partition in the same check.
  • Verify the Bedrock trust relationship and scoped S3 permissions. Check KMS and inference-profile permissions separately, then bind model and VPC settings in the route manifest.
  • Retain the role ARN, policy digest, input and output locations, model ID, idempotency token, and returned job ARN as one job record.

CreateModelInvocationJob makes the role explicit

The CreateModelInvocationJob API accepts a JSON request for batch inference and marks roleArn as required. AWS describes it as the service role with permissions to carry out and manage batch inference. The same request includes the model ID, input data configuration, output data configuration, job name, and optional VPC settings.

This is delegation. The authenticated application caller submits the job, then Bedrock uses a different IAM identity for the work. Keep those identities in separate fields. Caller authorization covers the claims-summary-batch operation, while trusted route policy chooses the role.

The server should map that business operation to one approved role ARN. It should also pin the permitted model resource and S3 prefixes. Pin the output encryption policy, VPC profile, timeout policy, and job tags in the same route manifest. Rebuild the outbound body from those trusted values and the validated business inputs.

The LLM API parameter allowlisting guide covers this field-reconstruction pattern at the HTTP boundary.

Exact ARN matching stops role substitution

AWS's API pattern identifies an IAM role ARN, but syntactic validity provides weak authorization. Parse the partition and account, then compare the complete normalized ARN with the route manifest. Reject another role name or a different path under the same name. Reject another account or an unexpected partition.

Compare and retain the complete role ARN. Reducing it to the final path segment collapses role/platform/bedrock-batch and role/legacy/bedrock-batch even though IAM treats them as different resources.

The submitting IAM principal also needs controlled authority to pass the service role. AWS's IAM PassRole guidance explains that iam:PassRole authorizes an identity to pass a role to a service and recommends restricting the resource plus the destination service. Scope that permission to approved batch roles instead of Resource: *.

Bind the route manifest to a digest over the role ARN and the job fields it governs. The per-route AI policies guide shows how caller identity and provider destination can share one reviewed decision record.

The trust policy binds Bedrock to the job source

AWS's custom batch service-role guide uses bedrock.amazonaws.com as the trusted service principal with sts:AssumeRole. Its recommended conditions include the source AWS account and a source ARN for model-invocation-job resources in the chosen Region and account.

Those conditions address the cross-service confused-deputy path. A deployment check should retrieve and decode the trust policy. It should confirm the expected principal, action, account condition, Region, and job-resource scope. Store a canonical policy digest with the release artifact.

AWS's example uses a wildcard in the job-resource suffix and notes that specific job IDs can replace it after creation. Your deployment process needs an explicit rule for that lifecycle. Avoid silently widening the account or Region because the next job ID is unknown at build time.

Trust validation belongs before the role enters the route manifest. Bedrock must be able to assume the service role independently of request-body validity.

Permissions must match the data path

AWS separates the submitting identity from the service role that carries out batch inference. Its batch permissions guide says the service role acts on the customer's behalf and highlights additional bucket policy work when input data lives in another AWS account.

For the batch role, AWS documents s3:GetObject and s3:PutObject for S3 access. It also documents s3:ListBucket over the input and output bucket resources. Scope object permissions to the intended prefixes where your S3 design permits it. Cross-account buckets need matching resource policies.

Customer-managed KMS keys add another binding. AWS lists kms:Decrypt for encrypted input and kms:GenerateDataKey for encrypted output, with an optional kms:ViaService condition for S3. Inference profiles require bedrock:InvokeModel over the profile and destination models described by the profile policy.

Put these dependencies in the release manifest. A role called BedrockBatchRole tells a reviewer nothing about the buckets and keys it can reach. The role name also omits its reachable model resources.

Job evidence starts before submission

Create a pending job record before sending the request. Include caller identity, application route, complete role ARN, trust and permissions policy digests, model ID, input and output S3 locations, encryption key reference, VPC profile, local policy version, and a digest over the final request.

Use the API's clientRequestToken for idempotent submission and retain it with the record. AWS says a matching token causes Bedrock to ignore the repeated request without returning an error. Reconciliation therefore needs the original token and response state rather than a second job name guessed by retry code. The safe idempotent LLM retries guide covers the transport discipline.

After HTTP success, attach the returned jobArn beside the role evidence. Because jobArn points to the batch job, keep the complete role ARN to preserve delegated execution authority.

On the review screen, show the full role ARN above two folder-shaped rows for input and output S3 prefixes. Put the model ID and job ARN below them in monospace. A substituted account number should be visible before an operator opens IAM.

Destructive tests prove the binding

Start with one authenticated request that resolves to the approved role and expected data locations. Capture the final wire body and assert exact values for roleArn and modelId. Check the input and output settings as separate objects. The VPC settings and clientRequestToken need their own assertions.

Then mutate one boundary at a time:

  • Caller supplies a different role ARN
  • Correct role name appears under a different IAM path
  • Role belongs to another account or partition
  • Trust policy omits the Bedrock service principal
  • Source account or source ARN condition widens unexpectedly
  • Input or output prefix falls outside the route manifest
  • KMS key differs from the approved output key
  • Inference profile lacks the required invocation resources
  • Retry reuses a token with changed job fields

Each mutation should fail before batch data or delegated authority reaches Bedrock. Add a provider fixture that returns a job ARN, then prove the audit record keeps both the approved role and returned job identifier.

The AI audit log schema guide supplies the common caller, route, policy, and correlation fields for that evidence.

DeepInspect

DeepInspect can enforce the batch-job role binding on authenticated HTTP requests deliberately routed to Amazon Bedrock. It can replace caller role input with the approved ARN and verify the job fields against route policy. It can also record the delegated identity plus request and response evidence before submission completes.

AWS remains responsible for assuming the role and running the accepted batch job. The application owns IAM role design, bucket and key policies, job monitoring, and output handling. Direct SDK calls, console submissions, local processing, STDIO traffic, and HTTP paths that bypass the proxy remain outside DeepInspect's enforcement boundary.

Book a technical deep dive at deepinspect.ai.

Frequently asked questions

Why does a Bedrock batch job need roleArn?

Batch inference reads input data and writes output. It may also use KMS, VPC, model, or inference-profile resources after submission. AWS requires a service-role ARN whose permissions let Bedrock carry out that work on the customer's behalf.

Should API clients choose the batch service role?

A production application should accept a business operation and resolve the service role from trusted server policy. Allowing clients to choose roleArn turns execution identity into caller input and weakens the binding among identity, data location, model, and job purpose.

What belongs in the role trust policy?

AWS's custom-role example trusts bedrock.amazonaws.com for sts:AssumeRole and recommends conditions for the source account plus the Bedrock model-invocation-job source ARN. Validate the exact account and Region used by the deployment.

Is the role ARN enough for an audit record?

The ARN identifies the delegated role. Reviewers also need the active trust and permission policy digests, model ID, S3 locations, encryption and VPC settings, caller identity, idempotency token, returned job ARN, and final submission disposition.