AWS Bedrock Integration
Complete guide to using AWS Bedrock with Bastio for Claude and other foundation models.
AWS Bedrock Integration
Use Claude and other foundation models through AWS Bedrock while maintaining Bastio's security protection.
Overview
AWS Bedrock provides access to Claude and other foundation models through Amazon's managed infrastructure. Bastio offers full support for AWS Bedrock, allowing you to:
- Use existing AWS infrastructure - Leverage your AWS account and billing
- Maintain compliance - Keep data within your AWS environment
- Access multiple models - Claude, Titan, Jurassic, and more
- Full security coverage - All Bastio security features work with Bedrock
- 100% feature parity - Identical to direct Anthropic integration
Supported Models
Bastio supports all Claude models available on AWS Bedrock:
| Model | Bedrock ID | Context | Input/Output Price |
|---|---|---|---|
| Claude 3.5 Sonnet (Latest) | anthropic.claude-3-5-sonnet-20241022-v2:0 | 200K | $3/$15 per 1M tokens |
| Claude 3.5 Sonnet | anthropic.claude-3-5-sonnet-20240620-v1:0 | 200K | $3/$15 per 1M tokens |
| Claude 3 Opus | anthropic.claude-3-opus-20240229-v1:0 | 200K | $15/$75 per 1M tokens |
| Claude 3 Sonnet | anthropic.claude-3-sonnet-20240229-v1:0 | 200K | $3/$15 per 1M tokens |
| Claude 3 Haiku | anthropic.claude-3-haiku-20240307-v1:0 | 200K | $0.25/$1.25 per 1M tokens |
| Claude 2.1 | anthropic.claude-v2:1 | 200K | $8/$24 per 1M tokens |
| Claude Instant | anthropic.claude-instant-v1 | 100K | $0.80/$2.40 per 1M tokens |
You can use either standard model names (e.g., claude-3-5-sonnet-20241022) or Bedrock model IDs - Bastio automatically maps between them.
Quick Start
Prerequisites
- AWS account with Bedrock access
- Claude model access enabled in AWS Console
- IAM credentials with Bedrock permissions
Step 1: Enable Bedrock in AWS
- Go to AWS Console → Bedrock
- Navigate to Model access
- Request access to Anthropic Claude models
- Wait for approval (usually instant)
Step 2: Create IAM Credentials
Create an IAM user or role with these permissions:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:*::foundation-model/anthropic.claude-*"
}]
}Save your credentials:
- Access Key ID:
AKIA... - Secret Access Key:
wJalrXUtn... - Region:
us-east-1(or your preferred region)
BYOK Mode (Bring Your Own Key)
Use your own AWS credentials with Bastio.
Via Dashboard
- Go to Dashboard → Proxies → Create New Proxy
- Select AWS Bedrock as provider
- Enter your AWS credentials as JSON:
{
"access_key_id": "AKIA...",
"secret_access_key": "wJalrXUtn...",
"region": "us-east-1"
}- Click Create Proxy
Via API
# Create Bedrock proxy
curl -X POST https://api.bastio.ai/proxy \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Bedrock",
"provider": "bedrock",
"llm_mode": "byok",
"model_behavior": "passthrough"
}'
# Add AWS credentials
curl -X POST https://api.bastio.ai/keys/provider \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider": "bedrock",
"key_name": "AWS Production",
"api_key": "{\"access_key_id\":\"AKIA...\",\"secret_access_key\":\"wJalrXUtn...\",\"region\":\"us-east-1\"}"
}'Platform Mode
Let Bastio manage AWS credentials for you.
How It Works
- Bastio provides pre-configured AWS credentials
- Pay with Bastio credits
- No AWS account needed
- Simplified billing
Enable Platform Mode
- Create proxy with LLM Mode: Platform
- Select AWS Bedrock as provider
- Choose your model
- Purchase credits in Billing section
Making Requests
Python Example
from openai import OpenAI
client = OpenAI(
base_url="https://api.bastio.ai/v1/guard/{PROXY_ID}/v1",
api_key="your-bastio-api-key"
)
# Use standard model name
response = client.chat.completions.create(
model="claude-3-5-sonnet-20241022",
messages=[
{"role": "user", "content": "Explain AWS Bedrock benefits"}
]
)
print(response.choices[0].message.content)JavaScript Example
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.bastio.ai/v1/guard/{PROXY_ID}/v1',
apiKey: process.env.BASTIO_API_KEY,
});
const response = await client.chat.completions.create({
model: 'claude-3-5-sonnet-20241022',
messages: [
{ role: 'user', content: 'Hello from Bedrock!' }
],
});
console.log(response.choices[0].message.content);Streaming Example
# Python streaming
stream = client.chat.completions.create(
model="claude-3-haiku-20240307",
messages=[{"role": "user", "content": "Write a short story"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Using Bedrock Model IDs
You can also use Bedrock's native model IDs:
response = client.chat.completions.create(
model="anthropic.claude-3-5-sonnet-20241022-v2:0", # Bedrock ID
messages=[{"role": "user", "content": "Hello!"}]
)Both formats work identically - Bastio automatically handles the mapping.
Model Validation
Bastio validates models for you:
# Both of these work:
curl -X POST https://api.bastio.ai/v1/guard/{PROXY_ID}/v1/chat/completions \
-d '{"model": "claude-3-haiku-20240307", ...}'
curl -X POST https://api.bastio.ai/v1/guard/{PROXY_ID}/v1/chat/completions \
-d '{"model": "anthropic.claude-3-haiku-20240307-v1:0", ...}'AWS Credential Format
Required Fields
{
"access_key_id": "AKIA...",
"secret_access_key": "wJalrXUtn...",
"region": "us-east-1"
}With Temporary Credentials
For STS temporary credentials, add session token:
{
"access_key_id": "ASIA...",
"secret_access_key": "wJalrXUtn...",
"region": "us-west-2",
"session_token": "FwoGZXIvYX..."
}Supported Regions
us-east-1(N. Virginia) ✅ Recommendedus-west-2(Oregon)eu-west-1(Ireland)eu-central-1(Frankfurt)ap-southeast-1(Singapore)ap-northeast-1(Tokyo)
Pricing & Cost Tracking
Bedrock vs Direct Anthropic
Most models have identical pricing:
| Model | Direct | Bedrock |
|---|---|---|
| Claude 3.5 Sonnet | $3/$15 | $3/$15 |
| Claude 3 Opus | $15/$75 | $15/$75 |
| Claude 3 Haiku | $0.25/$1.25 | $0.25/$1.25 |
Cost Tracking
Bastio automatically tracks costs:
- Dashboard - Real-time spending
- Analytics - Historical cost analysis
- Billing - Detailed breakdowns
Troubleshooting
Invalid AWS Credentials
Error: Invalid AWS credentials or Access denied
Solutions:
- Verify JSON format is correct (no trailing commas)
- Check credentials haven't expired
- Test with AWS CLI:
aws bedrock list-foundation-models --region us-east-1
Model Access Denied
Error: Model access denied or AccessDeniedException
Solutions:
- Go to AWS Console → Bedrock → Model access
- Enable Anthropic Claude models
- Wait for approval (usually instant)
Region Not Supported
Error: Region not supported or EndpointUnavailable
Solutions:
- Change region to
us-east-1,us-west-2, oreu-west-1 - Check AWS Bedrock regions
Throttling Exception
Error: ThrottlingException or Rate exceeded
Solutions:
- Check AWS Service Quotas dashboard
- Request quota increase for Bedrock
- Implement rate limiting in your app
Frequently Asked Questions
Q: Can I use both Bedrock and direct Anthropic? A: Yes! Create separate proxies for each and route requests as needed.
Q: Does streaming work? A: Yes, streaming is fully supported with identical functionality.
Q: Are there feature limitations? A: No, Bedrock has 100% feature parity with direct Anthropic.
Q: How do I switch from Anthropic to Bedrock? A: Create a new Bedrock proxy, update your proxy ID in your app, and test in staging before switching production.
Q: Can I use temporary AWS credentials?
A: Yes, include the session_token field in your credentials JSON.
Q: What if my credentials expire? A: Requests will fail with authentication errors. Update credentials in the Bastio dashboard.
When to Use Bedrock
Choose Bedrock if you:
- Already have AWS infrastructure
- Need AWS compliance/certifications
- Want consolidated AWS billing
- Require private VPC endpoints
- Have AWS enterprise agreements
Choose Direct Anthropic if you:
- Want simplest setup
- Don't have AWS account
- Prefer direct vendor relationship
- Need latest models immediately
Additional Resources
Need help? Contact support@bastio.ai or visit our support page.