Skip to content

fix: use AWS_REGION env var instead of hardcoded us-east-1 in dynamo_utils.py - #2009

Open
jyotsnamas wants to merge 1 commit into
awslabs:mainfrom
jyotsnamas:fix/dynamo-utils-region
Open

fix: use AWS_REGION env var instead of hardcoded us-east-1 in dynamo_utils.py#2009
jyotsnamas wants to merge 1 commit into
awslabs:mainfrom
jyotsnamas:fix/dynamo-utils-region

Conversation

@jyotsnamas

Copy link
Copy Markdown
Contributor

Summary

  • Fix 09-mcp-e2e/helpers/dynamo_utils.py which hardcodes region_name="us-east-1" for the DynamoDB client
  • deploy.py creates the DynamoDB table in the session region (e.g., us-west-2), but the runtime agent code connects to us-east-1
  • All DynamoDB tool calls fail with AccessDeniedException because the table doesn't exist in us-east-1

Root cause

# BROKEN (line 10):
def __init__(self, table_name="finance_tracker", region_name="us-east-1"):

# FIXED:
def __init__(self, table_name="finance_tracker", region_name=os.environ.get("AWS_REGION", os.environ.get("AWS_DEFAULT_REGION", "us-east-1"))):

Verification

Deployed 09-mcp-e2e/01-server-e2e to AgentCore Runtime in us-west-2 (with mcp pinned):

  • Without fix: tools/call add_transactionAccessDeniedException (table not in us-east-1)
  • With fix: tools/call get_balanceBalance: $-42.50, Total Income: $0.00, Total Expenses: $42.50

Test plan

  • Deploy 09-mcp-e2e/01-server-e2e with region fix → all finance tracker tools work
  • tools/list returns all 5 tools
  • tools/call add_transaction, get_balance return correct data
  • resources/list and prompts/list work

🤖 Generated with Claude Code

…utils

The FinanceDB class hardcoded us-east-1 as the DynamoDB region, but
deploy.py creates the table in the session region (e.g., us-west-2).
This causes AccessDeniedException when the deployed agent tries to
access the table. Now reads AWS_REGION/AWS_DEFAULT_REGION from env.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant