aws / aws/amazon-q-developer-cli

Q CLI does not use the default region in the AWS Profile

Open
#789 1 comment 1 reaction 0 assignees View on GitHub
Feature request
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

macOS 15.3.1 (24D70)

### Expected behaviour

When using AWS Q CLI with a local AWS profile that has a specific region configured, Q CLI should respect and use that default region when executing AWS CLI commands. In this case, when using the `davidmgre` profile which has `us-west-2` configured as its default region, all AWS CLI commands executed through Q CLI should automatically use `us-west-2` unless explicitly overridden.

### Actual behaviour

AWS Q CLI ignores the default region specified in the AWS profile configuration and defaults to `us-east-1` instead. When asked to perform operations against AWS resources, Q CLI initially attempts to run all commands in `us-east-1`, regardless of the region set in the profile configuration. This results in failed operations or missing resources when they exist in the configured region but not in `us-east-1`.

### Steps to reproduce

1. Create or modify an AWS profile in `~/.aws/config` with a non-default region:
```
[profile davidmgre]
output=json
region=us-west-2
```

2. Start AWS Q CLI and specify this profile:
```
q chat
```

3. Ask Q to perform an operation that would use AWS CLI with this profile:
```
Using the davidmgre AWS profile, tell me about the last data points for turbine 1 from our wind farm in sitewise.
```

4. Observe that Q CLI attempts to execute AWS CLI commands using `us-east-1` instead of `us-west-2`:
```
Running aws cli command:
Service name: iotsitewise
Operation name: list-assets
Parameters:
Profile name: davidmgre
Region: us-east-1
Label: List SiteWise assets
```

5. Only when the initial commands fail does Q CLI try with the correct region (`us-west-2`), and only then are resources found.

While Q CLI eventually finds the correct region and the resources, this behavior is inefficient and confusing to users. It results in failed initial attempts, and slower response times that could be avoided by simply honoring the region specified in the AWS profile configuration.

### Environment

```yaml
[q-details]
version = "1.7.0"
hash = "8885a6708f2f07d02d29460a96f9c422da095e49"
date = "2025-03-06T01:03:54.119908Z (5d ago)"
variant = "full"

[system-info]
os = "macOS 15.3.1 (24D70)"
chip = "Apple M1 Max"
total-cores = 10
memory = "64.00 GB"

[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "iTerm 2"
install-method = "unknown"

QTERM_SESSION_ID = "6f1ac702d0dd468ab9a252a5320870bc"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.7.0"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.googlecode.iterm2"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.