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 for AWS_SHARED_CREDENTIALS_FILE #3819

Open
Julian opened this issue Jul 26, 2018 · 4 comments
Open

Support for AWS_SHARED_CREDENTIALS_FILE #3819

Julian opened this issue Jul 26, 2018 · 4 comments

Comments

@Julian
Copy link

Julian commented Jul 26, 2018

It'd be great if boto supported the AWS_SHARED_CREDENTIALS_FILE environment variable that was introduced.

Seems like boto3 supports it just fine, but boto2 appears to not respect it (and just tries to directly look at ~/.aws/credentials regardless of whether it's set).

@pgilad
Copy link

pgilad commented Dec 8, 2019

Joining that request..

@yermulnik
Copy link

Looks like this is not going to be implemented? 😢

@Julian
Copy link
Author

Julian commented Apr 9, 2021

@yermulnik that's generally an unhelpful thing to say on an open source project (and I say that even being the one to have filed the ticket here).

It's open source. If we're interested in the feature suggested here, the maintainers haven't objected, and it's not yet implemented, that's generally our sign a PR is welcome.

@yermulnik
Copy link

Looking at the number of open PRs it doesn't look like maintainers are accepting them...
So my quick workaround was this:

--- /usr/local/Cellar/ansible/3.2.0/libexec/lib/python3.9/site-packages/boto/provider.py.orig   2021-04-09 21:44:18.000000000 +0300
+++ /usr/local/Cellar/ansible/3.2.0/libexec/lib/python3.9/site-packages/boto/provider.py        2021-04-09 21:47:32.000000000 +0300
@@ -193,7 +193,8 @@
         self._credential_expiry_time = None

         # Load shared credentials file if it exists
-        shared_path = os.path.join(expanduser('~'), '.' + name, 'credentials')
+        #shared_path = os.path.join(expanduser('~'), '.' + name, 'credentials')
+        shared_path = os.getenv('AWS_SHARED_CREDENTIALS_FILE', os.path.join(expanduser('~'), '.' + name, 'credentials'))
         self.shared_credentials = Config(do_load=False)
         if os.path.isfile(shared_path):
             self.shared_credentials.load_from_path(shared_path)

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

3 participants