Format and upload your inference data
To prepare inputs for batch inference, create a .jsonl file in the following format:
{ "recordId" : "
11 character alphanumeric string
", "modelInput" :{JSON body}
} ...
Each line contains a JSON object with a recordId
field and a modelInput
field containing the request body for an input you want to submit. The format of the modelInput
JSON object must match the body
field for the model that you use in the InvokeModel
request. For more information, see Inference parameters for foundation models.
Note
If you omit the recordId
field, Amazon Bedrock adds it in the output.
For example, you might provide a JSONL file containing the following line if you plan to run batch inference using the Anthropic Claude 3 Haiku model:
{ "recordId": "CALL0000001", "modelInput": { "anthropic_version": "bedrock-2023-05-31", "max_tokens": 1024, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Summarize the following call transcript: ..." } ] } ] } }
After uploading your input files to an S3 bucket, attach the following permissions to your batch inference service role and replace ${{s3-bucket-input}}
with the bucket that you uploaded the input files to and ${{s3-bucket-output}}
with the bucket that you want to write the output files to.
Important
Cross-account bucket access is currently not supported. The S3 bucket that you specify in this policy must belong to the account that will carry out the batch inference job.
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:GetObject", "s3:PutObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::
${{s3-bucket-input}}
", "arn:aws:s3:::${{s3-bucket-input}}
/*", "arn:aws:s3:::${{s3-bucket-output}}
", "arn:aws:s3:::${{s3-bucket-output}}
/*" ], "Effect": "Allow" } ] }