-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Explicit --profile option should have precedence over credentials env vars #113
Comments
I have the same issue, and agree that an explicit profile should take precedence over environment variables that are commonly used by other tools in addition to aws-cli. Is there a design reason for this? I'll implement the fix and create a PR if one would be welcome. |
If I have AWS environment variables, is there anyway for me to give the AWS config file precedence over the environment variables? So far the only way I've found is to delete the environment variables. |
Is there any movement on this issue? |
+1 |
100% agree on this. What I've done for the time being is actually have an alias around the No question in my mind that an explicitly specified |
I'm currently having the same issue. As stated above I also think that explicitly defined options should have precedence over the environment. Setting |
I’ve been struggling with IAM setting up IAM policies and testing them with Any chance to get this into the next release? |
Also having this issue. |
What can we do to assist with closing out this nearly 2 year old issue? Folks seem unified that having explicitly defined option overridden by environment variables is a Bad Thing(tm). Is a PR needed to get this done? |
This behavior contradicts the documentation found at http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#config-settings-and-precedence |
Taking a look. I agree this should be fixed. |
This changes the behavior of environment variable credential loading to function as described in aws/aws-cli#113. Here is what this looks like for both the CLI and Botocore/Boto 3: CLI: ```bash $ AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws s3 ls $ AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws --profile dev s3 ls ``` Python: ```python $ AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar python >>> import boto3 >>> boto3.setup_default_session(profile_name='dev') >>> # The following will use the profile, not the env vars! >>> s3dev = boto3.resource('s3') ``` Added a test and a new log message to ensure it's obvious what is happening.
This is now fixed. See below:
Closing issue. |
👏 🎉 |
I have credentials for a primary account set in
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
to support other tools. When I try to pass a--profile
option for anaws-cli
command, the profile is not used and the account in env is -- I have tounset
the env vars in order to use profiles. I believe that an option given explicitly should have precedence over the environment.The text was updated successfully, but these errors were encountered: