Skip to content

How do I resolve this Bedrock Batch Inference Job Create error?

0

InvalidInputException There were problems with the supplied replacements: [Missing multi-value replacements required by the template for [outputput_bucket_names_with_or_without_object_prefixes]]

  • I picked a unique job name
  • I am using claude anthropic sonnet 3.5 v2, which I have access to in us-west-2
  • I am using us-west-2, and my buckets are all in us-west-2
  • I am specifying for input Uri: s3://MYINPUTBUCKETNAME/MYFOLDER/MYINPUTFILE.jsonl
  • I am specifying for output Uri: s3://MYOUTPUTBUCKETNAME/MYFOLDER/
  • For both output and input bucket, I used the GUI to select the exact folder and the exact jsonl file, respectively, so they should exist and be correct URIs.
  • I do not have any role created, so I let it create a role for me, I set the role name to be "ai-insights-role-for-bedrock"

I hit create, and I get this weird error. What does it mean and how do I get past this?

If I try this in code, by manually creating the previewed role shown to me(since I can't create it here), in code I am able to get the job to submit, it fails at Validation step saying:

Could not validate ListBucket permissions for S3URI: s3://MYINPUTBUCKETNAME/MYFOLDER/MYINPUTFILE.jsonl. Please ensure the IAM role has the necessary permissions to access the specified S3 bucket. Additionally, confirm that the S3 bucket and the Bedrock client are located in the same AWS region.

However, the permissions were set to exactly what the previewed role gave me, and the boto3 bedrock client was created with region_name="us-west-2.

asked 2 years ago2.5K views

2 Answers
1
Accepted Answer

Hello,

Greetings of the day!

From the response, I understand that you are experiencing an error while creating the batch jobs.

The first error appears to be related to an issue during the IAM role creation and the second error is S3 permission issue. Please use the following permissions and trust relationship, and apply that role while creating a job.

[1] Create an IAM policy with the following permissions. Replace MYINPUTBUCKETNAME and MYOUTPUTBUCKETNAME with your actual bucket names. Also, replace YOURAWSACCOUNTID with your AWS account ID.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::MYINPUTBUCKETNAME",
        "arn:aws:s3:::MYINPUTBUCKETNAME/*",
        "arn:aws:s3:::MYOUTPUTBUCKETNAME",
        "arn:aws:s3:::MYOUTPUTBUCKETNAME/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceAccount": "YOURAWSACCOUNTID"
        }
      }
    }
  ]
}

[2] Create a role with the following trust policy. Please replace YOURAWSACCOUNTID with your AWS account ID. Also, attach the above-created policy to this role.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "bedrock.amazonaws.com"
            },
            "Action": "sts:AssumeRole",
            "Condition": {
                "StringEquals": {
                    "aws:SourceAccount": "YOURAWSACCOUNTID"
                },
                "ArnEquals": {
                    "aws:SourceArn": "arn:aws:bedrock:us-west-2:YOURAWSACCOUNTID:model-invocation-job/*"
                }
            }
        }
    ]
}

Once the role is created, create a batch job and select the existing role created above. If the issue persist even after following above steps, please contact AWS support from the concerned account so they can check the your account logs for the same.

Thanks!

Resource: [1] https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference-permissions.html#batch-inference-permissions-service

AWS
EXPERT

answered 2 years ago

  • Thanks, I actually already tried this, but when creating the role I think I must've made a hard to see typo, because repeating your advice again worked this time for in console.

    I will try doing it via-code and see if the second error is cleared up too.

  • This works in code too, eliminating the other error.

-1

Based on the information you've provided, there are a few potential issues that could be causing the errors you're encountering with your Bedrock Batch Inference job:

  1. Role Permissions: The error message suggests that there might be an issue with the IAM role permissions. Even though you've created a role based on the preview, it's possible that the role doesn't have the necessary permissions to access your S3 bucket. Double-check that the role has the appropriate S3 permissions, including ListBucket, GetObject, and PutObject for the specific bucket and folders you're using.

  2. S3 Bucket Configuration: Ensure that your S3 bucket is properly configured to allow access from the Bedrock service. This includes having the correct bucket policy and CORS configuration if necessary.

  3. Input/Output URI Format: While you mentioned using the GUI to select the correct folders and files, it's worth double-checking the exact format of your input and output URIs. For the input, make sure it points to the specific JSONL file. For the output, ensure it points to the folder where you want the results to be stored.

  4. Job Configuration: The initial error message mentions "Missing multi-value replacements required by the template for [outputput_bucket_names_with_or_without_object_prefixes]". This suggests there might be an issue with how the output configuration is being set. Make sure you're providing all required fields in the job configuration, including the correct output data config.

To resolve these issues:

  1. Review and update the IAM role permissions to ensure it has full access to the specific S3 bucket and objects you're using for input and output.

  2. Verify your S3 bucket settings, ensuring it's accessible from the same region as your Bedrock client.

  3. Double-check the format of your input and output URIs, making sure they're correctly pointing to the JSONL file and output folder respectively.

  4. If you're using the API or SDK to create the job, ensure all required fields are properly filled out in your CreateModelInvocationJob request, including the inputDataConfig and outputDataConfig.

  5. Try creating a new IAM role with broader permissions temporarily to isolate whether it's a permissions issue.

If these steps don't resolve the issue, you may need to contact AWS support for further assistance, as there could be account-specific or service-related issues that aren't immediately apparent.
Sources
Create a batch inference job - Amazon Bedrock
Enhance performance of generative language models with self-consistency prompting on Amazon Bedrock | AWS Machine Learning Blog
Error in AWS Bedrock Batch Inteference | AWS re:Post

answered 2 years ago

  • This is unhelpful.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.