- Newest
- Most votes
- Most comments
Hello.
Since the error "because no identity-based policy allows the bedrock:InvokeModel action" occurs, I think the following IAM role is not allowed to execute the action "bedrock:InvokeModel".
Why not try setting an IAM policy that allows "bedrock:InvokeModel" for the IAM role?
amplify-recipeai-fvisc-sa-amplifyDataL2GraphqlApibe-VbOwpQeNWefz
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "test",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel"
],
"Resource": "*"
}
]
}
The error "You don't have access to the model with the specified model ID" typically occurs when you don't have proper access to the specific Amazon Bedrock model you're trying to use, even though you may have general access to the Bedrock service.
Based on your screenshots and description, here are the likely causes and solutions:
-
Model Access: While you've enabled access to Bedrock in general, you need to explicitly request access to each specific foundation model you want to use. This is a separate process from setting up IAM permissions or enabling the service.
-
Steps to resolve:
- Log in to the AWS Console and navigate to the Amazon Bedrock service
- In the Bedrock console, select "Model access" from the menu
- Find the specific model that the application is trying to use (check the application code to identify which model ID it's using)
- Request access to that model by following the console instructions
- Wait for the access request to be approved (usually quick but may take some time)
- Other potential issues:
- Verify that the model ID format in the application code is correct (some models have specific format requirements)
- Check that you're using the same AWS region for both your model access and application
- Ensure your IAM role/user has the necessary permissions (bedrock:InvokeModel)
- If using AWS Organizations, check there aren't any policies disabling access to AI/ML services
- Region considerations: Model availability can vary by region. Try using us-east-1 if you're not already, as it typically has the most comprehensive model support.
Once you've requested and been granted access to the specific model the application is trying to use, the error should be resolved.
Sources
Difficulties Accessing AWS Bedrock Models from AWS lambda | AWS re:Post
Why am I getting "The provided model identifier is invalid" | AWS re:Post
"Invalid Model Identifier Error in Amazon Bedrock and Unable to Request Specific Models" | AWS re:Post
ok I changed the model from : anthropic.claude-3-sonnet-20240229-v1:0 to anthropic.claude-3-5-sonnet-20241022-v2:0
and now I get:
{ "data": { "askBedrock": { "body": "{\"Message\":\"User: arn:aws:sts::58678X:assumed-role/amplify-recipeai-fvisc-sa-amplifyDataL2GraphqlApibe-VbOwpQeNWefz/APPSYNC_ASSUME_ROLE is not authorized to perform: bedrock:InvokeModel on resource: arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0 because no identity-based policy allows the bedrock:InvokeModel action\"}", "error": null } } }
how can I solve that?
answered a year ago
Relevant content
asked 2 years ago
