Allowlist S3 URIs for Amazon Bedrock Batch Inference
Amazon Bedrock batch inference reads input from one S3 location and writes results to another. An authenticated submission gateway can restrict those two URIs to approved buckets and prefixes before CreateModelInvocationJob reaches AWS. Durable enforcement still belongs in the Bedrock service role, S3 bucket policies, and KMS policies because the long-running job accesses S3 after submission.

Amazon Bedrock CreateModelInvocationJob accepts an input S3 URI, an output S3 URI, and a service-role ARN. Those three strings decide which stored prompts Bedrock will read and where model responses will land after the HTTP submission finishes. A route that accepts any syntactically valid s3:// value gives the caller storage-selection authority. I would bind both locations to reviewed bucket-and-prefix tuples before AWS credentials are attached to the request.
TL;DR
- Allow exact input and output bucket-and-prefix pairs for each authenticated batch route.
- Validate
s3BucketOwnerwith the URI, then retain both as submission evidence. - Treat a folder URI as a scope grant because Bedrock processes the JSONL and accompanying content at that location.
- Keep the Bedrock service role and S3 bucket policies narrow. They enforce access after the proxy has recorded the submission.
The batch request names two storage boundaries
The Amazon Bedrock CreateModelInvocationJob API requires inputDataConfig, outputDataConfig, modelId, roleArn, and jobName. The current request uses an s3InputDataConfig union member for input and an s3OutputDataConfig union member for output. Each S3 object requires s3Uri.
AWS documents each URI as a string between 1 and 1,024 characters. The API pattern begins with s3://, followed by a bucket name and an optional path. Both S3 configuration objects also accept an optional s3BucketOwner, expressed as a 12-digit AWS account ID. Input can declare s3InputFormat, whose documented value is JSONL.
Syntax validation establishes that AWS can parse the field. Authorization needs a route-specific decision about the permitted bucket, prefix, account owner, model, and service role. The LLM API parameter allowlisting guide covers that larger separation between provider capability and enterprise permission.
An allowlist should compare parsed components
Parse each URI once with an S3-aware library, then compare structured values. The policy record should contain the bucket, normalized key prefix, expected owner account, direction, approved service-role ARN, and route policy version. Keep input and output entries separate because one grants read scope while the other selects a write destination.
Use exact bucket matching. Apply prefix matching only on a path boundary, so an approved finance/jobs/ prefix never accepts finance/jobs-archive/. Preserve S3 key case because AWS states that these paths are case-sensitive. Reject user-info syntax, query strings, fragments, encoded path tricks, repeated separators that your parser treats inconsistently, and any value the serializer would change after policy approval.
The outbound request should be rebuilt from the accepted components rather than forwarding the caller's original JSON object. Compare the final serialized s3Uri values immediately before SigV4 signing.
My blunt opinion is that a bucket-only allowlist is unfinished work. It turns a six-character prefix typo into authority over every object the service role can reach inside that bucket.
Folder URIs expand the input scope
AWS's batch inference data guide says the input location must contain at least one JSONL file. When the input URI identifies a folder, batch inference processes the JSONL and accompanying content files at that location. The guide gives a more specific rule for prompts that reference S3-hosted media: linked resources must sit in the same bucket and folder, and InputDataConfig must identify the folder rather than only the JSONL object.
That behavior changes the review question. An approved folder is a collection boundary, not a pointer to one known file. Record a manifest or inventory digest during the data-staging workflow when the release process needs file-level evidence. Freeze or version the prefix before submission, and keep writers other than the staging role away from it during the job window.
The submission proxy sees the top-level URI in CreateModelInvocationJob. It lacks automatic visibility into JSONL bytes and nested S3 media references that Bedrock reads later. A separate staging validator must inspect those files before release. Pretending the HTTP allowlist scanned the stored batch would create false audit evidence.
IAM and S3 remain the durable enforcement layer
Amazon Bedrock assumes the roleArn supplied in the job request and accesses S3 after accepting the submission. AWS's batch service-role guide grants the role s3:GetObject, s3:PutObject, and s3:ListBucket over the named input and output resources in its example. Production policy should narrow those resources to the approved buckets and prefixes required by the route.
Cross-account storage needs another layer. AWS says an S3 bucket policy must allow the service role when the batch data bucket belongs to a different account. Bind that grant to the exact role principal and intended resource paths. s3BucketOwner gives Bedrock an expected account ID in the API request; it never replaces the bucket policy.
Use the gateway allowlist to stop unauthorized submission choices and produce an identity-bound decision record. Use IAM and S3 policy to constrain what the assumed role can read or write during the long-running job. The AWS Bedrock security guide explains the wider distinction between per-request authorization and AWS account controls.
Release tests need URI mutations and post-submit checks
Start with an authenticated request that selects one approved input prefix, output prefix, owner account, model, and service role. Capture the final request fields plus the returned jobArn. On the review screen, print both full URIs in monospace text. Put the bucket owner directly beneath each one, so a one-digit account change is visible without opening raw JSON.
Then mutate one property per fixture:
- Substitute another input bucket in the same AWS account
- Keep the bucket and move one directory above the approved prefix
- Replace
jobs/with the neighboringjobs-archive/path - Change URI letter case inside the object key
- Supply the correct bucket with a different
s3BucketOwner - Point output at the approved bucket under an unapproved tenant prefix
- Pair approved URIs with another service-role ARN
- Add an encoded separator or a suffix after a parser-visible query marker
Every submission mutation should stop before SigV4 credentials are attached. Run separate AWS integration tests against the service role and bucket policies. Those tests should prove that direct or post-submit access outside the approved resources receives AccessDenied, even when the gateway is absent.
The per-route AI policies guide provides the policy structure for binding these destination rules to one batch operation instead of applying a broad application-wide grant.
DeepInspect
DeepInspect can inspect authenticated user or agent HTTP calls to CreateModelInvocationJob. It can parse and allowlist the top-level S3 locations, bind them to an approved Bedrock model and service-role ARN, reject caller destination changes, and record the submission decision before the request reaches AWS.
Amazon S3, IAM, AWS KMS, and the Bedrock service role enforce access after submission. DeepInspect cannot enforce bucket policy, inspect later S3 reads and writes, or govern a job submitted through a direct AWS path that bypasses the proxy. The staging workflow also owns the JSONL files and any nested S3 resources referenced inside them.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- Should the policy allow a whole S3 bucket?
Use the smallest prefix that contains the staged input or designated output. A whole-bucket grant gives every object under the service role's S3 permissions the same submission status. Prefix-scoped route policy, IAM resources, and bucket policy make the intended batch boundary visible and testable.
- Does s3BucketOwner authorize cross-account access?
s3BucketOwnercarries the expected 12-digit owner account in the Bedrock request. Cross-account authorization still comes from IAM and the S3 bucket policy. Validate the owner field together with the bucket name, then test the service role against the destination account.- Can the gateway inspect S3 files referenced inside the JSONL?
The authenticated job-submission request exposes the top-level input and output configuration. Stored JSONL content and nested media URIs sit in S3, outside that HTTP body. A staging scanner or release workflow must inspect and approve those objects before submission.
- What should the audit record preserve?
Keep the authenticated caller or agent, route, parsed input and output bucket, prefix, owner account, service-role ARN, model ID, policy version, final serialized request digest, decision, timestamp, and returned
jobArn. Avoid storing prompt files inside the policy log.