Closed
Description
Describe the bug
In an AWS CLI configuration file with many profiles, it's useful to set a default region for all accounts, but it looks like the region
parameter in the [default]
section is ignored.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
After signing in, AWS CLI commands succeed.
Current Behavior
AWS CLI displays:
You must specify a region. You can also configure your region by running "aws configure".
When running aws configure list
, it's clearly shown that the default region is ignored:
Name Value Type Location
---- ----- ---- --------
region <not set> None None
Reproduction Steps
- Create a AWS CLI config file like this:
[default]
region = us-west-1
[sso-session test]
sso_start_url = https://awssso.example.com
sso_region = us-west-1
sso_registration_scopes = sso:account:access
[profile account1]
sso_session = test
sso_account_id = 1234
sso_role_name = ReadOnlyAccess
- Set the profile and log into account1:
export AWS_PROFILE=account1
aws sso login
- Try to access some resources:
aws ec2 describe-instances
- List the current settings:
aws configure list
Possible Solution
No response
Additional Information/Context
The error also happens when setting the profile via the --profile
parameter (as opposed to the environment variable AWS_PROFILE
).
CLI version used
aws-cli/2.23.6 Python/3.13.3 Linux/6.12.25-amd64 source/x86_64.debian.13
Environment details (OS name and version, etc.)
Debian Linux 13