-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Using non-default profile #21
Comments
@zen4ever unfortunately this isn't exposed in this way yet, but I do think it's something we should add. Here are a couple of workarounds that work right now:
import botocore.session
import boto3
# Set your profile name on a low-level Botocore session
session = botocore.session.get_session()
session.profile = 'my-profile-name'
# Tell Boto 3 to use that session by default
boto3.setup_default_session(botocore_session=session)
# Now create a resource
ec2 = boto3.resource('ec2') Piping a profile name in through the |
Nice. Botocore session seems like a good workaround for now. :-) |
Great, thanks 👍 |
How do you get a list of available profiles? |
@revmischa You can look at your config file at ~/.aws/config or its corresponding ~/.aws/credentials |
That's a terrible answer |
@revmischa This is what I was able to come up with. Should print out all available boto profiles.
|
Is there a simple way to use a non-default profile by specifying it's name?
Like on boto there is
I see that I can construct a session with credentials and region, but I don't see an ability to just refer to the profile's name
The text was updated successfully, but these errors were encountered: