rkoval / alfred-aws-console-services-workflow

A powerful workflow for quickly opening up AWS Console Services in your browser or searching for entities within them.
MIT License
312 stars 54 forks source link

None of the profiles defined in ~/.aws/config are found #60

Closed erstaples closed 1 year ago

erstaples commented 1 year ago

The workflow doesn't recognize any of my profiles. In Alfred I type aws @profile and I get "No matching profiles found" despite all of the profiles I have defined in my ~/.aws/config file. How do I set up my config and credentials so that the workflow recognizes the profiles? My ~/.aws files follow this format:

; ~/.aws/credentials
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 
aws_session_token = AQoDYXdzEJr...
; ~/.aws/config
[default]
region = us-east-1

[profile dev]
role_arn= arn:aws:iam::123456789012:role/TheRoleName
source_profile = default

[profile sandbox]
role_arn = arn:aws:iam::456789012345:role/TheRoleName
source_profile = default

[profile prod]
role_arn = arn:aws:iam::901234567890:role/TheRoleName
source_profile = default

The env variables set in the workflow are as follows:

Name Value
AWS_CONFIG_FILE /Users/me/.aws/config
AWS_SDK_LOAD_CONFIG true
AWS_SHARED_CREDENTIALS_FILE /Users/me/.aws/credentials
erstaples commented 1 year ago

I noticed this line in the README, which explains why I'm not seeing my profiles... mine are configured in ~/.aws/config. Is there any way to tell the workflow to look in ~/.aws/config for the list of profiles?

Profile override - By default, searchers will use the default profile configured in your ~/.aws/credentials file. However, you can override this on a single query basis by typing @. This workflow will then populate the list of profiles defined in your ~/.aws/credentials file.

erstaples commented 1 year ago

Closing this. 10 years as a developer and I'm just now realizing I've been setting up my ~/.aws/credentials files wrong. I did not realize it was standard practice to include a [<profilename>] entry in the credentials file for every [profile <profilename>] in the config file!