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

Add a --profile flag to specify default profile #563

Merged
merged 1 commit into from
Mar 16, 2018
Merged

Conversation

ejholmes
Copy link
Contributor

@ejholmes ejholmes commented Mar 14, 2018

This adds a --profile flag, similar to the --region flag that specifies a global default profile for stacker to use for all AWS API calls, when no explicit profile is specified.

Another way to do this is is to specify the AWS_PROFILE or AWS_DEFAULT_PROFILE environment variable, but in certain configurations that won't actually work.

@@ -23,6 +25,9 @@ def get_session(region, profile=None):
:class:`boto3.session.Session`: A boto3 session with
credential caching
"""
if profile is None:
profile = default_profile

Copy link
Member

Choose a reason for hiding this comment

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

Do you think it's worth adding a debug log in here so we can see what profiles/regions sessions are being created in?

@phobologic
Copy link
Member

Should we have some documentation about why this flag exists? Maybe in the flag help syntax itself? Also does it overwrite AWS_PROFILE if both are provided?

@ejholmes
Copy link
Contributor Author

Good call. Extended the flag docs and added some debug logging to get_session:

[2018-03-15T17:05:52] DEBUG dev/vpc stacker.session_cache:29(get_session): No AWS profile explicitly provided. Falling back to default.
[2018-03-15T17:05:52] DEBUG dev/vpc stacker.session_cache:32(get_session): Building session using profile "dev" in region "us-west-1"

@ejholmes ejholmes changed the base branch from threadsafe-cred-cache to master March 16, 2018 00:13
@ejholmes ejholmes merged commit ae2beee into master Mar 16, 2018
@ejholmes ejholmes deleted the profile-flag branch March 16, 2018 00:29
phrohdoh pushed a commit to phrohdoh/stacker that referenced this pull request Dec 18, 2018
Add a --profile flag to specify default profile
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.

2 participants