Skip to content

aws login generates config with unnecessary "profile" prefix #9863

@c19yamamoto

Description

@c19yamamoto

Describe the bug

When using the aws login command, it automatically updates the ~/.aws/config file with a new section. The command forces the format [profile <name>] including the "profile " prefix.

While this format is technically valid for the CLI, the prefix is redundant. The CLI works correctly with the simpler [<name>] format in the config file. Including the prefix by default causes ambiguity or warnings when this config file is parsed by other tools (such as the AWS SDK for Java).

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The aws login command should generate the configuration entry without the "profile " prefix in ~/.aws/config.

Expected format:

[test-profile]
login_session = arn:aws:sts::000000000000:assumed-role/example/user@example.com
region = us-east-1

Current Behavior

The command currently generates the configuration entry with the "profile " prefix.

Current result:

[profile test-profile]
login_session = arn:aws:sts::000000000000:assumed-role/example/user@example.com
region = us-east-1

Reproduction Steps

  1. Configure a profile for SSO or execute a login command that writes to the config.
aws login --profile test-profile
  1. Open the ~/.aws/config file.
  2. Observe that the section header is generated as [profile test-profile] instead of [test-profile].

Possible Solution

No response

Additional Information/Context

No response

CLI version used

2.32.2

Environment details (OS name and version, etc.)

macOS Tahoe 26.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions