Claude Code shell does not inherit AWS_REGION from user's terminal session
Description
When Claude Code runs Bash tool calls, the shell does not inherit environment variables set in the user's terminal session — specifically AWS_REGION (and AWS_DEFAULT_REGION). This causes all aws CLI and pulumi commands that depend on region configuration to silently fall back to us-east-1, even when the user has AWS_REGION=us-west-2 set in their own shell.
Steps to Reproduce
- In your terminal, run
export AWS_REGION=us-west-2 - Open Claude Code in that terminal (or in a project where it's launched from that session)
- Ask Claude to run any AWS CLI command, e.g.
aws ecs list-clusters - The command executes against
us-east-1instead ofus-west-2
Expected Behavior
Claude Code's Bash tool should inherit environment variables from the shell session it was launched from, or at minimum respect AWS_REGION / AWS_DEFAULT_REGION if set in the user's environment.
Actual Behavior
The Bash tool uses a fresh shell that does not inherit the user's exported environment variables. Region-dependent AWS and Pulumi commands silently use the wrong region.
Workaround
Prefix every aws/pulumi Bash call with the region inline:
AWS_REGION=us-west-2 aws ecs list-clusters
AWS_REGION=us-west-2 pulumi up --stack stage
This is workable but requires the region to be hardcoded in project instructions (CLAUDE.md).
Environment
- Platform: macOS (darwin)
- Shell: zsh
- Claude Code version: current
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗