Skip to content

Conversation

@jmehnle
Copy link
Contributor

@jmehnle jmehnle commented Feb 2, 2018

This allows to choose from what AWS profile to choose credentials from ~/.aws/credentials.

@ricoveri
Copy link

ricoveri commented Feb 7, 2018

+1 on this.

Currently, my workaround is to set AWS_PROFILE environment variable since boto/boto3 takes those anyway. This would be a nice to have instead of hardcoding AWS credentials. :) 👍

This allows to choose from what AWS profile to choose credentials from `~/.aws/credentials`.

def read_cfg(path_to_config_file, profile_name):
cfg = read(path_to_config_file, loader=yaml.load)
if profile_name is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of:
if profile_name is not None:

Couldn't you just do:
if profile_name:

return boto3.client(
client,
boto3.setup_default_session(
profile_name=profile_name,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a profile name is set, should secret\access keys still be set?

@javamonkey79 javamonkey79 merged commit 92a8913 into nficano:master Feb 15, 2018
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

Successfully merging this pull request may close these issues.

3 participants