Claude Code shell does not inherit AWS_REGION from user's terminal session

Resolved 💬 2 comments Opened May 30, 2026 by ericdummer Closed Jul 3, 2026

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

  1. In your terminal, run export AWS_REGION=us-west-2
  2. Open Claude Code in that terminal (or in a project where it's launched from that session)
  3. Ask Claude to run any AWS CLI command, e.g. aws ecs list-clusters
  4. The command executes against us-east-1 instead of us-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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗