Skip to content

Default region in ~/.aws/config is ignored #9499

Closed
@srgoni

Description

@srgoni

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

  1. 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
  1. Set the profile and log into account1:
export AWS_PROFILE=account1
aws sso login
  1. Try to access some resources:
aws ec2 describe-instances
  1. 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

Metadata

Metadata

Labels

bugThis issue is a bug.configurationp3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions