Overview
AWS Bedrock provides access to multiple foundation models from Amazon, Anthropic, Meta, Mistral, and others through a single API. Enterprise-grade with AWS security and compliance. Model Class:BedrockConverseModel
Authentication
AWS Credentials
Configure AWS credentials using one of these methods:Using infer_model
Manual Configuration
With Custom Region
Examples
Basic Usage
With Guardrails
With Request Metadata
With Amazon Nova
Cross-Region Inference
Prompt Caching
Bedrock supports prompt caching for supported models (primarily Claude):Cache Benefits
- Cost Savings: Reduced input token costs
- Latency: Faster processing
- Automatic: No configuration for Claude models
- Model-Specific: Check model documentation for support
Model Parameters
Base Settings
| Parameter | Type | Description | Default |
|---|---|---|---|
max_tokens | int | Maximum tokens to generate | 2048 |
temperature | float | Sampling temperature | 1.0 |
top_p | float | Nucleus sampling | 1.0 |
stop_sequences | list[str] | Stop sequences | None |
Bedrock-Specific Settings
| Parameter | Type | Description |
|---|---|---|
bedrock_guardrail_config | dict | Content moderation settings |
bedrock_performance_configuration | dict | Performance optimization |
bedrock_request_metadata | dict[str, str] | Request metadata for tracking |
bedrock_additional_model_response_fields_paths | list[str] | Additional response fields |
bedrock_prompt_variables | dict | Template variables |
bedrock_additional_model_requests_fields | dict | Model-specific parameters |
Guardrail Configuration
Performance Configuration
Example Configuration
Available Models
Amazon Nova
us.amazon.nova-pro-v1:0: Balanced performanceus.amazon.nova-lite-v1:0: Fast and affordableus.amazon.nova-micro-v1:0: Ultra-lightweight
Anthropic Claude
anthropic.claude-3-5-sonnet-20241022-v2:0: Latest Claudeus.anthropic.claude-3-5-sonnet-20241022-v2:0: Cross-regionanthropic.claude-3-5-haiku-20241022-v1:0: Fast variantus.anthropic.claude-3-7-sonnet-20250219-v1:0: Enhanced capabilitiesus.anthropic.claude-opus-4-20250514-v1:0: Most powerful
Meta Llama
meta.llama3-1-70b-instruct-v1:0: Large modelmeta.llama3-1-8b-instruct-v1:0: Efficient modelus.meta.llama3-2-90b-instruct-v1:0: Latest largeus.meta.llama3-3-70b-instruct-v1:0: Latest generation
Mistral
mistral.mistral-large-2407-v1:0: Most capablemistral.mixtral-8x7b-instruct-v0:1: Fast and efficient
Cohere
cohere.command-r-plus-v1:0: Most capablecohere.command-r-v1:0: Balanced option
Model Selection Guide
| Use Case | Recommended Model | Why |
|---|---|---|
| Complex reasoning | Claude Opus 4 | Best reasoning capabilities |
| Balanced performance | Claude Sonnet 3.5 | Speed + quality |
| Cost-effective | Nova Lite | Amazon’s affordable option |
| Code generation | Claude Sonnet 3.5 | Strong code understanding |
| High volume | Llama 3.1 8B | Fast and efficient |
Best Practices
- Use Cross-Region Models: Better availability with
us.prefix - Enable Guardrails: For production content filtering
- Set Request Metadata: For tracking and debugging
- Choose Right Model: Match model to use case and budget
- Monitor CloudWatch: Track usage and costs
- Use IAM Roles: More secure than access keys
- Enable CloudTrail: Audit API calls
- Leverage Prompt Caching: For Claude models with repeated contexts
Security and Compliance
IAM Permissions
Required IAM permissions:VPC Endpoints
Deploy Bedrock in VPC for enhanced security:Compliance
Bedrock supports:- HIPAA
- SOC 1, 2, 3
- ISO 27001, 27017, 27018
- PCI DSS
- FedRAMP (select regions)
Cost Optimization
- Choose Appropriate Model: Don’t overpay for capabilities you don’t need
- Use Nova Models: Amazon’s models are cost-effective
- Enable Prompt Caching: Significant savings for Claude
- Monitor Usage: Set CloudWatch alarms for costs
- Use Lite/Micro Variants: For simple tasks

