SETTINGS · tooling-foundation
Claude Code settings for Bedrock
Project settings plus a team shell profile that run Claude Code against Bedrock in eu-west-2, with federated credentials and OTel attribution.
✓ verified 2026-06-10 · stack: claude-code, bedrock, aws · source
Two files that move a team’s Claude Code usage onto Bedrock: a checked-in
.claude/settings.json so the repo itself selects Bedrock and the EU Geo
model, and a distributed shell profile for the credential and telemetry
pieces that must not live in the repo.
{ "model": "eu.anthropic.claude-sonnet-4-6", "env": { "CLAUDE_CODE_USE_BEDROCK": "1", "AWS_REGION": "eu-west-2" }}# Claude Code -> Amazon Bedrock (eu-west-2)export CLAUDE_CODE_USE_BEDROCK=1export AWS_REGION=eu-west-2
# Credentials: an IdP-federated or SSO profile — never long-lived keys.# IdP federation (production): profile assumes a role via# AssumeRoleWithWebIdentity; gives per-user attribution.# IAM Identity Center: aws sso login --profile claude-code-bedrockexport AWS_PROFILE=claude-code-bedrock
# Optional: OTel usage attribution for the platform team's dashboardsexport OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector.internal.example.comexport OTEL_SERVICE_NAME=claude-codeexport OTEL_RESOURCE_ATTRIBUTES="team=${TEAM},costcenter=${COSTCENTER}"The matching IAM for the assumed role is intentionally narrow:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream" ], "Resource": [ "arn:aws:bedrock:*:<ACCOUNT>:inference-profile/*", "arn:aws:bedrock:*::foundation-model/anthropic.claude-*" ] } ]}What it does
CLAUDE_CODE_USE_BEDROCK=1switches Claude Code’s backend to Bedrock; the session then authenticates with standard AWS credential resolution (AWS_PROFILE, or explicitAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKENfor temporary credentials).- The checked-in
settings.jsonpins the EU Geographic profile (eu.anthropic.claude-sonnet-4-6) so every session in the repo satisfies the EU-boundary residency requirement without per-developer setup. - The shell profile carries what must not be committed: which AWS profile to use and where OTel telemetry goes. With IdP federation, OIDC claims (email, team) flow into spans, which is what makes per-developer cost dashboards possible.
- The IAM policy allows model invocation only (no
bedrock:*, no console actions), and the foundation-model wildcard is needed because inference profiles resolve to underlying Anthropic model ARNs across regions.
Failure modes
- Wrong account. Run this against a dedicated Claude Code AWS account,
not dev or prod: heavy interactive use shares TPM quota with whatever
else lives in the account, and the guidance’s reference architecture
isolates it for exactly that reason. Tighten the
inference-profile/*resource to specific profile ARNs (with thebedrock:InferenceProfileArncondition on the foundation-model statement) when teams get their own profiles. - Long-term API keys creep in. Bedrock API keys work with Claude Code and are tempting for onboarding; AWS recommends them only for short-term testing. Short-term keys expire within 12 hours; long-term keys create an IAM user and should not survive a pilot. The federated profile path is the production answer.
- EU Geo needs destination-region IAM. If invocations fail intermittently with access denied, the role is missing foundation-model permissions in one of the Geo profile’s EU destination regions, or an SCP blocks that region. See the Terraform artifact for the correct resource list.
- Model availability drift. The pinned model ID is correct as of 2026-06-10; when the team moves models, change it here once rather than letting developers override locally and fragment the fleet.
settings.jsonenv does not set your shell. Subshells and scripts a developer runs outside Claude Code do not inherit the repo settings; the shell profile is what keepsawsCLI usage and Claude Code pointed at the same profile and region.
Verified against the AWS solution guidance for Claude Code with Amazon Bedrock (auth options, dedicated-account recommendation, OTel attribution) and the Bedrock deployment-patterns blog (environment variables), 2026-06-10.