aws / aws/amazon-q-developer-cli

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

Aperta
#789 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Feature request
Lingua principale
Rust
Stelle
2k
Fork
439
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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"
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il problema con q chat e il profilo davidmgre definito in ~/.aws/config, dopo aver eseguito q doctor e q restart. Esamina il modo in cui i comandi AWS CLI ricevono il profilo e la regione, quindi verifica che venga utilizzata una regione us-west-2 configurata senza un tentativo iniziale con us-east-1. Il lavoro è completato quando i comandi rispettano la regione del profilo, a meno che non venga sovrascritta esplicitamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, rust
Ambito
cli, cloud
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.