Skip to content

Support Bedrock region configuration independent of AWS_REGION #4860

@AJM10565

Description

@AJM10565

Problem

When using Amazon Bedrock with application inference profiles, the Bedrock region is determined by AWS_REGION / AWS_DEFAULT_REGION environment variables. In enterprise environments, teams commonly set AWS_REGION to one region (e.g. us-east-1) for general AWS CLI operations, while their Bedrock inference profiles live in a different region (e.g. us-west-2).

This forces users to override AWS_REGION specifically when launching pi, which creates friction when running AWS CLI commands from within pi sessions that need the original region.

Current Behavior

Region resolution in getConfiguredBedrockRegion():

options.region || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || undefined

The only way to set options.region is programmatically — there is no CLI flag or settings.json field exposed to users.

Proposed Solution

One or more of:

  1. Parse region from ARN: If the model ID is an inference profile ARN (arn:aws:bedrock:<region>:<account>:application-inference-profile/...), extract and use the region from it automatically. This is the most ergonomic solution since the region is already embedded in the identifier.

  2. Add a --region CLI flag: Allow pi --provider amazon-bedrock --region us-west-2 to set options.region directly.

  3. Add a region field to settings.json: Allow persistent configuration:

    {
      "provider": "amazon-bedrock",
      "region": "us-west-2"
    }
  4. Support a dedicated env var like AWS_BEDROCK_REGION that takes priority over AWS_REGION for Bedrock specifically.

Use Case

  • AWS_REGION=us-east-1 set globally for all AWS CLI tooling
  • Bedrock inference profiles provisioned in us-west-2
  • Model configured as an inference profile ARN pointing to us-west-2

Currently requires wrapping pi launch with AWS_REGION=us-west-2 pi, which then breaks AWS CLI commands run from within the pi session that expect us-east-1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions