Skip to content

config is invisible to aws-cli due to use of dots #445

Description

@RemiCardona

Hi all,

I was in the process of automating my SSO login and was ultimately trying to read aws-adfs configuration from my profile using aws configure get and could NOT, for the life of me, get it to print anything.

$ aws configure get --profile PROFILE adfs_config.adfs_user 
$

After much screaming and cursing, I dug into aws-cli and basically found this:

https://github.com/aws/aws-cli/blob/2.32.17/awscli/customizations/configure/get.py#L58

TL;DR aws configure considers dots as separators for configuration sections, so aws-adfs configuration keys cannot be queried using aws-cli.

Various solutions include:

  1. replacing dots with underscores in the config keys
[profile PROFILE]
region = us-west-1
adfs_config_adfs_user = remi.cardona@example.com
...
  1. using sections as supported by .aws/config:
[profile PROFILE]
region = us-west-1
adfs_config =
  adfs_user = remi.cardona@example.com

That last one seems the "prettiest", though I would suggest using botocore to read the configuration (instead of python's configparser directly):

https://github.com/boto/botocore/blob/develop/botocore/configloader.py#L183

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions