Skip to content

AWS Bedrock

AWS Bedrock allows you to use Anthropic Claude models hosted within your own AWS account. This provider invokes Bedrock via the AWS CLI, which means it benefits from your existing AWS SSO and IAM configuration.


Provider Details

PropertyValue
Config keybedrock
Default modelus.anthropic.claude-sonnet-4-20250514-v1:0
Auth methodAWS CLI profile (supports SSO, IAM roles, and credential chains)

Configuration

yaml
ai:
  default_provider: bedrock
  providers:
    bedrock:
      aws_profile: your-bedrock-aws-profile
      region: us-east-1
      model: us.anthropic.claude-sonnet-4-20250514-v1:0

The aws_profile field specifies which AWS CLI profile to use for Bedrock API calls. This can be different from the profile used for infrastructure queries.


Environment Variables

Bedrock authentication relies on standard AWS environment variables and credential chains. No Clanker-specific environment variable is needed. The AWS CLI profile referenced in aws_profile must have bedrock:InvokeModel permissions.


CLI Flag Overrides

FlagDescription
--ai-profile bedrockSelect this provider

There are no dedicated key or model override flags for Bedrock. To change the model, update ai.providers.bedrock.model in the config file.


Setup

  1. Ensure your AWS CLI profile has access to Amazon Bedrock in the specified region.
  2. Request access to the desired model in the Bedrock console if you have not already done so.
  3. Verify access:
bash
aws bedrock-runtime invoke-model \
  --model-id us.anthropic.claude-sonnet-4-20250514-v1:0 \
  --body '{"anthropic_version":"bedrock-2023-05-31","max_tokens":100,"messages":[{"role":"user","content":"Hello"}]}' \
  --profile your-bedrock-aws-profile \
  --region us-east-1 \
  /dev/stdout

Usage Example

yaml
# ~/.clanker.yaml
ai:
  default_provider: bedrock
  providers:
    bedrock:
      aws_profile: commercial-dev
      region: us-east-1
      model: us.anthropic.claude-sonnet-4-20250514-v1:0
bash
clanker ask "What ECS services are running?"

Notes

  • Bedrock uses the AWS CLI bedrock-runtime invoke-model command under the hood. Request and response data are exchanged through temporary files to avoid command-line length limits.
  • Because Bedrock runs within your AWS account, data does not leave your infrastructure. This makes it suitable for environments with strict data residency requirements.
  • Clanker retries Bedrock requests up to 5 times with exponential backoff if a transient error (throttling, overload) is detected.