aws-bedrock provider supports all text-output models available via the AWS Bedrock Converse API.
Quick Start
Authentication
AWS Bedrock uses standard AWS authentication methods. Choose the method that best fits your environment:AWS Profile (Development)
When developing locally, use AWS CLI profiles:AWS Services (Lambda/ECS/EC2)
In AWS environments, BAML automatically uses the service’s IAM role:- Use execution roles in Lambda
- Use task roles in ECS
- Use instance profiles in EC2
- Never hardcode credentials in AWS environments
Environment Variables
Set AWS credentials as environment variables:Explicit Credentials
Specify credentials directly in BAML configuration:Credential Resolution Order
BAML resolves AWS credentials in this order:- Explicit BAML Configuration -
access_key_id,secret_access_keyin options - Environment Variables -
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_PROFILE - AWS Configuration Files -
~/.aws/credentialsand~/.aws/config - Instance Metadata - IAM role credentials (EC2/ECS only)
Important Rules
All or Nothing: If you provide any credential explicitly, you must provide all required credentials. Session Token Requirements: When usingsession_token, provide all three: access_key_id, secret_access_key, and session_token.
Profile Exclusivity: When using profile, you cannot specify other credentials.
Configuration Options
BAML-Specific Options
The AWS region to use.
AWS access key ID.
AWS secret access key.
Temporary session token. Required if using temporary credentials.
AWS profile name from credentials file.
AWS endpoint URL. Useful for using a VPC endpoint.
Supported Models
The Bedrock model ID to use. You must request model access before use.
Anthropic Claude (Latest Generation)
anthropic.claude-opus-4-1-20250805-v1:0- Most powerful codinganthropic.claude-sonnet-4-20250514-v1:0- Best default, 1M context availableanthropic.claude-3-5-haiku-20241022-v1:0- Fast and efficient
Meta Llama (Latest Generation)
meta.llama4-maverick-17b-instruct-v1:0- Latest Llama 4meta.llama3-3-70b-instruct-v1:0- Enhanced Llama 3.3
aws bedrock list-foundation-models | jq '.modelSummaries.[].modelId' to see all available models in your region.Model Parameters
Model-specific additional parameters (e.g., for Claude thinking models).
IAM Permissions
Required permissions for basic Bedrock access:Cross-Account Access
To use Bedrock from a different AWS account:- Set up the target account role (where Bedrock is):
- Configure the source account (where your application runs):
Media Handling
AWS Bedrock converts most media to base64 by default (
send_base64 for images, audio, and PDFs). Consider using S3 presigned URLs with send_url mode for large files to avoid base64 overhead.Features
- Streaming: Supported via
InvokeModelWithResponseStream - Multimodal: Support depends on the specific model
- Cross-Region: Use any AWS region where Bedrock is available
- VPC Endpoints: Private connectivity support