Environment:Anthropics Anthropic sdk python AWS Bedrock Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Cloud_Provider |
| Last Updated | 2026-02-15 12:00 GMT |
Overview
AWS Bedrock provider environment requiring boto3/botocore and AWS credentials for accessing Claude models via Amazon Bedrock.
Description
This environment extends the core SDK environment with AWS-specific dependencies. It requires boto3 for AWS SDK access and botocore for low-level AWS service interaction. The Bedrock client infers the AWS region from environment variables or the boto3 session, defaulting to us-east-1 if unspecified. Authentication uses standard AWS credential chains (IAM roles, environment variables, credential files).
Usage
Use this environment when deploying Claude models through Amazon Bedrock instead of the direct Anthropic API. Required for the Cloud Provider Deployment workflow with Bedrock as the target provider.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, Windows | Same as core SDK |
| Python | >= 3.9 | Same as core SDK |
| Network | HTTPS outbound to AWS Bedrock endpoints | Region-specific endpoints |
| AWS Account | Bedrock model access enabled | Must request model access in AWS console |
Dependencies
Python Packages (Required)
- All core SDK dependencies (see Environment:Anthropics_Anthropic_sdk_python_Python_SDK_Core_Environment)
boto3>= 1.28.57botocore>= 1.31.57
Credentials
The following environment variables are used:
AWS_REGION: AWS region for Bedrock API calls. Falls back to boto3 session region, thenus-east-1.AWS_ACCESS_KEY_ID: AWS access key (standard AWS credential chain).AWS_SECRET_ACCESS_KEY: AWS secret key (standard AWS credential chain).AWS_SESSION_TOKEN: Optional session token for temporary credentials.ANTHROPIC_BEDROCK_BASE_URL: Override the Bedrock endpoint URL.
Quick Install
pip install 'anthropic[bedrock]'
Code Evidence
Optional dependency declaration from pyproject.toml:44:
bedrock = ["boto3 >= 1.28.57", "botocore >= 1.31.57"]
Region inference logic from bedrock/_client.py:70-90:
def _infer_region() -> str:
aws_region = os.environ.get("AWS_REGION")
if aws_region is None:
try:
import boto3
session = boto3.Session()
if session.region_name:
aws_region = session.region_name
except ImportError:
pass
if aws_region is None:
log.warning("No AWS region specified, defaulting to us-east-1")
aws_region = "us-east-1" # fall back to legacy behavior
return aws_region
API limitation checks from bedrock/_client.py:61-65:
if options.url.startswith("/v1/messages/batches"):
raise AnthropicError("The Batch API is not supported in Bedrock yet")
if options.url == "/v1/messages/count_tokens":
raise AnthropicError("Token counting is not supported in Bedrock yet")
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
MissingDependencyError: ... pip install anthropic[bedrock] |
boto3/botocore not installed | Run pip install 'anthropic[bedrock]'
|
No AWS region specified, defaulting to us-east-1 (warning) |
AWS_REGION not set and boto3 session has no region | Set AWS_REGION environment variable
|
AnthropicError: The Batch API is not supported in Bedrock yet |
Batch API called via Bedrock client | Use direct Anthropic API for batch operations |
AnthropicError: Token counting is not supported in Bedrock yet |
count_tokens called via Bedrock | Use direct Anthropic API for token counting |
Compatibility Notes
- Batch API: Not supported through Bedrock. Use the direct Anthropic API client instead.
- Token Counting: Not supported through Bedrock.
- Region Fallback: If no region is specified, defaults to
us-east-1with a warning logged.