AWS Bedrock Configuration
AWS Bedrock provides access to foundation models from Amazon and third-party providers like Anthropic Claude, Meta Llama, and Mistral.Prerequisites
- An AWS account with Bedrock access enabled
- IAM credentials with permissions to invoke Bedrock models
- The desired models enabled in your AWS Bedrock console
Environment Variables
When running OpenHands with Docker, set the following environment variables using-e:
Make sure you have enabled the Bedrock models you want to use in the AWS Console. Go to Amazon Bedrock → Model access and request access to the models you need.
UI Configuration
In the OpenHands UI Settings under theLLM tab:
- Enable
Advancedoptions - Set the following:
Custom Modelto the Bedrock model ID (see Model IDs)- Leave
Base URLempty (Bedrock uses AWS endpoints automatically) - Leave
API Keyempty (authentication is handled via AWS credentials)
Model IDs
Bedrock model IDs are managed by AWS and may change over time. Use the exact Model ID from the AWS Console or the AWS documentation (nobedrock/ prefix).
Example format:
Custom Model:anthropic.claude-3-5-sonnet-20241022-v2:0
Cross-Region Inference
Some Bedrock models can be invoked across regions by prefixing the model ID with the target region (for example,us.):
Custom Model:<region>.<model-id>
Using IAM Roles (Alternative to Access Keys)
If running OpenHands on AWS infrastructure (EC2, ECS, Lambda), you can use IAM roles instead of access keys:- Attach an IAM role with Bedrock permissions to your compute resource
- Omit the
LLM_AWS_ACCESS_KEY_IDandLLM_AWS_SECRET_ACCESS_KEYenvironment variables - The AWS SDK will automatically use the instance role credentials
Troubleshooting
”No module named ‘boto3’” Error
If you encounter this error:This issue is resolved in recent OpenHands releases. If you still see it, upgrade to
latest (or a recent release tag).Access Denied Errors
If you receive access denied errors:- Verify your IAM credentials have the
bedrock:InvokeModelpermission - Check that the model is enabled in your AWS Bedrock console
- Ensure you’re using the correct AWS region where the model is available
Model Not Found
If the model is not found:- Verify the model ID is correct (check AWS documentation)
- Ensure the model is enabled in your Bedrock model access settings
- Check that the model is available in your selected AWS region

