Open bhdicaire opened 6 years ago
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).awsSession()
(or stored somewhere global 😬)
func (a *awsSyncCmdGenerator) deleteOldEntities()
calls iam := newIamClient(awsSession())
func (a *AwsFetcher) init()
calls s := awsSession()
for IAM and S3func (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
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.