AWS Bedrock¶
Run models through AWS Bedrock. Both claude-bedrock and gemini-bedrock use @langchain/aws and support either explicit credentials or the AWS default credential chain.
Authentication¶
Bedrock supports two authentication methods:
If no explicit credentials are set, the AWS SDK uses the default credential chain:
- Environment variables
- Shared credentials file (
~/.aws/credentials) - SSO credentials
- EC2/ECS instance role
- And more...
Environment Variables¶
| Env Var | Required | Default | Description |
|---|---|---|---|
AWS_REGION |
No | us-east-1 |
AWS region |
AWS_ACCESS_KEY_ID |
No* | -- | IAM access key |
AWS_SECRET_ACCESS_KEY |
No* | -- | IAM secret key |
* Credential requirement
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are not required if you are using the AWS default credential chain (e.g., IAM role, SSO, ~/.aws/credentials).
claude-bedrock¶
Claude models on AWS Bedrock.
Model Naming¶
Bedrock uses full model IDs
Bedrock model IDs differ from the Anthropic API. Use the full ARN-style identifier.
| Anthropic API | Bedrock Model ID |
|---|---|
claude-opus-4-6 |
anthropic.claude-opus-4-6-v1 |
claude-sonnet-4-20250514 |
anthropic.claude-sonnet-4-20250514-v1 |
Setup¶
Usage¶
pnpm run generate -- --provider claude-bedrock
# Override model
pnpm run generate -- --provider claude-bedrock --model anthropic.claude-sonnet-4-20250514-v1
gemini-bedrock¶
Gemini models on AWS Bedrock, also via @langchain/aws (ChatBedrockConverse).
Setup¶
Usage¶
pnpm run generate -- --provider gemini-bedrock
# Override model
pnpm run generate -- --provider gemini-bedrock --model gemini-2.5-pro
Prerequisites¶
Enable models in the Bedrock console
Before using any model on Bedrock, you must enable access in the AWS Bedrock console:
- Open the AWS Bedrock console
- Navigate to Model access
- Request access to the desired model(s)
- Wait for approval (Claude models may require a brief approval period)
Region availability
Not all models are available in all AWS regions. us-east-1 and us-west-2 have the broadest model support.