Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AWS CLI --profile #43

Open
bhdicaire opened this issue Jul 21, 2018 · 1 comment
Open

Support AWS CLI --profile #43

bhdicaire opened this issue Jul 21, 2018 · 1 comment

Comments

@bhdicaire
Copy link

To the best of my knowledge, it's currently impossible to identify which profile stored in ~/.aws/credentials to use with iamy.

I'll recommend to include profile as pull and push sub parameter to support AWS CLI --profile.

@pda
Copy link
Contributor

pda commented Jul 23, 2018

This will require a fair bit of internal change;

  • awsSession() caches the session; it will need to guard against returning the wrong session for a profile (key the cache by profile, or at least validate the cached session is the same profile as requested).
  • the profile name needs to be passed through to all callers of awsSession() (or stored somewhere global 😬)
    • func (a *awsSyncCmdGenerator) deleteOldEntities() calls iam := newIamClient(awsSession())
    • func (a *AwsFetcher) init() calls s := awsSession() for IAM and S3
    • func (a *AwsFetcher) getAccount() (*Account, error) calls acct.Id, err = GetAwsAccountId(awsSession()) for IAM and sometimes EC2.

Instead, you could set AWS_PROFILE in your environment, and aws-sdk-go will pick it up from there as per https://godoc.org/github.com/aws/aws-sdk-go/aws/session#hdr-Creating_Sessions

AWS_PROFILE=foo iamy pull --delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants