Last active
February 23, 2026 16:38
-
-
Save mrballcb/b2df55ce61d6dd0dbf9f88773b679843 to your computer and use it in GitHub Desktop.
Wrapper script and configs I use to run claude cli with AWS Bedrock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export AWS_REGION=your-aws-region | |
| export AWS_PROFILE=your-aws-profile-with-bedrock-enabledj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e -o pipefail | |
| tmpfile=$(mktemp) | |
| # When the script finishes or is cancelled, clean up the temp file | |
| trap \ | |
| "{ rm -vf ${tmpfile}; }" \ | |
| SIGINT SIGTERM ERR EXIT | |
| [ -f $HOME/.claude/env.sh ] && source $HOME/.claude/env.sh | |
| #### Get list of Anthropic models | |
| aws bedrock list-foundation-models --by-provider anthropic | jq '.' > $tmpfile | |
| #### Extract latest version of specific models | |
| export ANTHROPIC_DEFAULT_HAIKU_MODEL=us.$(cat $tmpfile | jq -r '.modelSummaries[] | select(.modelName | contains("Haiku")) | select(.modelLifecycle.status == "ACTIVE") | .modelId' | sed 's/.*-\([0-9]\{8\}\)-.*/\1 &/' | sort -n | tail -1 | cut -d' ' -f2) | |
| export ANTHROPIC_DEFAULT_OPUS_MODEL=us.$(cat $tmpfile | jq -r '.modelSummaries[] | select(.modelName | contains("Opus")) | select(.modelLifecycle.status == "ACTIVE") | .modelId' | sed 's/.*-\([0-9]\{8\}\)-.*/\1 &/' | sort -n | tail -1 | cut -d' ' -f2) | |
| export ANTHROPIC_DEFAULT_SONNET_MODEL=us.$(cat $tmpfile | jq -r '.modelSummaries[] | select(.modelName | contains("Sonnet")) | select(.modelLifecycle.status == "ACTIVE") | .modelId' | sed 's/.*-\([0-9]\{8\}\)-.*/\1 &/' | sort -n | tail -1 | cut -d' ' -f2) | |
| export ANTHROPIC_MODEL=sonnet | |
| #### User asked for list of available models | |
| if [[ $1 =~ "help" ]] || [[ $1 =~ "models" ]]; then | |
| echo "Available Anthropic models:" | |
| cat $tmpfile | jq -r '.modelSummaries[] | select(.modelName | select(.modelLifecycle.status == "ACTIVE") | .modelId' | sed 's/.*-\([0-9]\{8\}\)-.*/\1 &/' | sort -n | |
| shift | |
| fi | |
| echo "Using default $ANTHROPIC_MODEL ($ANTHROPIC_DEFAULT_SONNET_MODEL) on $AWS_PROFILE in $AWS_REGION" | |
| echo | |
| claude $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "env": { | |
| "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1", | |
| "CLAUDE_CODE_USE_BEDROCK": "1", | |
| "ANTHROPIC_SMALL_FAST_MODEL": "haiku", | |
| "DISABLE_PROMPT_CACHING": "0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment