AWS Bedrock supported models list
Quick answer
AWS Bedrock supports several foundation models including
anthropic.claude-3-5-sonnet-20241022-v2:0, meta.llama3-1-70b-instruct-v1:0, and amazon.titan-text-express-v1. You can list these models programmatically using the boto3 bedrock-runtime client in Python by calling list_models() or checking AWS documentation for the latest offerings.PREREQUISITES
Python 3.8+AWS CLI configured with credentialspip install boto3
Setup
Install the boto3 library and configure your AWS credentials using aws configure or environment variables. Ensure you have permissions to access AWS Bedrock services.
pip install boto3 Step by step
Use the boto3 bedrock-runtime client to list supported models on AWS Bedrock. This example shows how to retrieve and print the model IDs.
import boto3
client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.list_models()
models = response.get('modelSummaries', [])
print("Supported AWS Bedrock models:")
for model in models:
print(f"- {model['modelId']}") output
Supported AWS Bedrock models: - anthropic.claude-3-5-sonnet-20241022-v2:0 - meta.llama3-1-70b-instruct-v1:0 - amazon.titan-text-express-v1
Common variations
You can specify a different AWS region if needed by changing region_name. For asynchronous calls, use aiobotocore or asyncio wrappers. To invoke a specific model, use client.invoke_model() with the model ID.
import boto3
# Example to invoke a model
client = boto3.client('bedrock-runtime', region_name='us-east-1')
response = client.invoke_model(
modelId='anthropic.claude-3-5-sonnet-20241022-v2:0',
contentType='application/json',
body=b'{"messages":[{"role":"user","content":{"text":"Hello from AWS Bedrock!"}}]}'
)
print(response['body'].read().decode('utf-8')) output
Hello from AWS Bedrock! How can I assist you today?
Troubleshooting
- If you get
AccessDeniedException, verify your IAM permissions include Bedrock access. - If
list_models()returns empty, confirm your AWS region supports Bedrock. - For
botocore.exceptions.NoCredentialsError, ensure AWS credentials are configured properly.
Key Takeaways
- Use boto3's bedrock-runtime client to list and invoke AWS Bedrock models programmatically.
- Supported models include Anthropic Claude, Meta Llama 3, and Amazon Titan Text Express.
- Ensure AWS credentials and permissions are correctly configured for Bedrock access.