This guide explains how to use ralphex with Claude models hosted on AWS Bedrock.
AWS Bedrock provides access to Claude models through your AWS account. This allows organizations to:
- Use Claude without a direct Anthropic API subscription
- Keep data within their AWS environment
- Leverage existing AWS IAM for access control
Never expose your primary AWS credentials. Create a dedicated AWS profile with minimal permissions for ralphex:
- Use a separate IAM user or SSO permission set
- Apply least-privilege IAM policy (see below)
- Use short-lived credentials when possible (SSO, STS)
- ralphex never mounts
~/.aws- it exports only the specific credentials needed
Avoid passing secrets on the command line. When using -E to pass environment variables:
- Prefer
-E VAR(inherit form) over-E VAR=valuefor secrets - Values in
-E VAR=valueare visible inpsoutput to other users on the system - The inherit form passes the variable name only; Docker reads the value from the environment
Create an IAM policy with only the permissions required for Claude via Bedrock.
Standard policy (all Claude models in all regions):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "BedrockInvokeFoundationModels",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:*::foundation-model/anthropic.claude-*"
]
},
{
"Sid": "BedrockInvokeInferenceProfiles",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:*:*:inference-profile/*anthropic.claude*"
]
}
]
}Restrictive policy (specific region and models):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "BedrockInvokeClaudeFoundationModels",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-20250514-v1:0",
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-haiku-4-20250514-v1:0"
]
},
{
"Sid": "BedrockInvokeClaudeInferenceProfiles",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:us-east-1:*:inference-profile/us.anthropic.claude-sonnet-4-20250514-v1:0",
"arn:aws:bedrock:us-east-1:*:inference-profile/us.anthropic.claude-haiku-4-20250514-v1:0"
]
}
]
}Note: Inference profiles use cross-region prefixes (e.g., us.anthropic.claude-* for US regions). Check your Bedrock console for exact inference profile IDs available in your account.
AWS SSO provides short-lived credentials and centralized access management.
- Create a permission set in AWS IAM Identity Center with the policy above
- Assign the permission set to your user/group for the target account
- Configure a local profile:
aws configure sso --profile ralphex-bedrock- Login before using ralphex:
aws sso login --profile=ralphex-bedrock- Run ralphex with Bedrock:
export AWS_PROFILE=ralphex-bedrock
export AWS_REGION=us-east-1
ralphex --claude-provider bedrock docs/plans/feature.mdFor environments where SSO isn't available.
- Create an IAM user with the policy above attached
- Generate access keys for the user
- Configure a local profile:
aws configure --profile ralphex-bedrock
# Enter access key ID and secret from IAM user- Run ralphex with Bedrock:
export AWS_PROFILE=ralphex-bedrock
export AWS_REGION=us-east-1
ralphex --claude-provider bedrock docs/plans/feature.mdFor CI/CD environments or when you have temporary credentials.
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=AKIA...
export AWS_SECRET_ACCESS_KEY=...
# Optional: export AWS_SESSION_TOKEN=... (for temporary credentials)
ralphex --claude-provider bedrock docs/plans/feature.md| Variable | Description |
|---|---|
AWS_REGION |
AWS region where Bedrock is enabled (e.g., us-east-1) |
Note: CLAUDE_CODE_USE_BEDROCK=1 is automatically set when using --claude-provider bedrock or RALPHEX_CLAUDE_PROVIDER=bedrock.
| Variable | Description |
|---|---|
AWS_PROFILE |
AWS CLI profile name (credentials exported automatically) |
AWS_ACCESS_KEY_ID |
Explicit access key (with AWS_SECRET_ACCESS_KEY) |
| Variable | Description |
|---|---|
RALPHEX_CLAUDE_PROVIDER |
Set to bedrock to enable Bedrock mode (alternative to --claude-provider flag) |
| Variable | Description |
|---|---|
ANTHROPIC_MODEL |
Override default Claude model |
ANTHROPIC_SMALL_FAST_MODEL |
Model for fast operations |
ANTHROPIC_DEFAULT_OPUS_MODEL |
Custom Opus model ARN |
ANTHROPIC_DEFAULT_SONNET_MODEL |
Custom Sonnet model ARN |
ANTHROPIC_DEFAULT_HAIKU_MODEL |
Custom Haiku model ARN |
ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION |
AWS region for small/fast model |
ANTHROPIC_BEDROCK_BASE_URL |
Custom Bedrock endpoint |
AWS_BEARER_TOKEN_BEDROCK |
Bearer token for Bedrock API key auth |
CLAUDE_CODE_SKIP_BEDROCK_AUTH |
Skip Bedrock authentication (for testing) |
DISABLE_PROMPT_CACHING |
Set to disable prompt caching |
# Set required environment
export AWS_PROFILE=ralphex-bedrock
export AWS_REGION=us-east-1
# Login if needed
aws sso login --profile=ralphex-bedrock
# Run with Bedrock provider
ralphex --claude-provider bedrock docs/plans/feature.mdexport AWS_PROFILE=ralphex-bedrock
export AWS_REGION=us-east-1
export RALPHEX_CLAUDE_PROVIDER=bedrock
# All ralphex commands now use Bedrock
ralphex docs/plans/feature.md
ralphex --reviewexport AWS_PROFILE=ralphex-bedrock
export AWS_REGION=us-east-1
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000
# Pass extra env vars to container
ralphex --claude-provider bedrock -E CLAUDE_CODE_MAX_OUTPUT_TOKENS docs/plans/feature.mdWhen using Bedrock mode, ralphex shows the provider configuration:
With profile-based credentials:
using image: ghcr.io/umputun/ralphex-go:latest
claude provider: bedrock (keychain skipped)
exporting credentials from profile: my-sso-profile
passing: AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, CLAUDE_CODE_USE_BEDROCK
With explicit credentials:
using image: ghcr.io/umputun/ralphex-go:latest
claude provider: bedrock (keychain skipped)
using explicit credentials
passing: AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, CLAUDE_CODE_USE_BEDROCK
Your SSO session has expired. Re-authenticate:
aws sso login --profile=ralphex-bedrockYour IAM policy is missing required permissions. Verify:
- The policy includes
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStream - The resource ARN matches the model you're trying to use
- The policy is attached to your user/role
The specified model isn't available in your region or account:
- Check that Claude models are enabled in your Bedrock console
- Verify your
AWS_REGIONmatches where models are enabled - For inference profiles, check the exact ARN in your Bedrock console
ralphex couldn't export credentials from your profile:
- Verify
aws configure export-credentials --profile YOUR_PROFILEworks manually - Check that you're logged in (for SSO profiles)
- Try using explicit credentials as a workaround
When using Bedrock mode, ralphex skips the Claude configuration directory check. If you see this error, ensure you're using --claude-provider bedrock flag.
The aws CLI is not installed on your host. Install it to enable automatic credential export from profiles. Alternatively, use explicit credentials.