Comments (8)
@revmischa This is what I was able to come up with. Should print out all available boto profiles.
#!/usr/bin/env python
import boto3
session = boto3.Session()
print session.available_profiles
from boto3.
That's a terrible answer
from boto3.
@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:
- Set the
BOTO_DEFAULT_PROFILE
environment variable to the name of the profile. Docs for env vars - Use your own Botocore session:
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 client
and resource
calls will require some changes on the Botocore side, so I'll investigate how best to approach this. Thanks for the feedback, and sorry I overlooked this use case! 👍
from boto3.
Nice. Botocore session seems like a good workaround for now. :-)
from boto3.
@zen4ever it's now possible to set a profile name without dropping down to Botocore sessions. Please take a look at the docs in #69 and let me know if you have any other questions!
from boto3.
Great, thanks 👍
from boto3.
How do you get a list of available profiles?
from boto3.
@revmischa You can look at your config file at ~/.aws/config or its corresponding ~/.aws/credentials
from boto3.
Related Issues (20)
- AWS CLI works but boto3 reports Token has expired and refresh failed HOT 2
- On some platforms, `parse_timestamp` throws RuntimeError: Unable to calculate correct timezone offset for "-62135596800" HOT 3
- AWS_PROFILE environment variable overrides session credentials HOT 2
- Mistake in the ComprehendMedical Documentation HOT 2
- bedrock_agent_runtime APIs are not returning source metadata HOT 2
- Redshift Data Paginator misleading documentation for `NextToken` when setting `MaxItems` HOT 2
- Documentation of put_object is confusing HOT 3
- Document of S3.Client.download_file uses the resource interface HOT 2
- dynamodb client.batch_get_item() fails in case keys contains duplicates HOT 2
- Memory Leak in S3's download_fileobj and upload_fileobj Methods HOT 8
- Request for Addition of API to Adjust Spot Instance Limit HOT 2
- S3 generate_presigned_post does not include success_action_redirect in the policy HOT 3
- An error occurred (403) when calling the HeadObject operation: Forbidden for missing field HOT 2
- Explanation of the freeze of resources development HOT 3
- using boto3.client(xxxxx).get_object donw data,It speed have very difference. HOT 6
- on_done not called when token has expired HOT 14
- Generate presigned URL not working with put_object HOT 2
- upload_fileobj hangs indefinitely without returning error HOT 13
- Add short name for region in describe_regions() or describe_endpoints() HOT 3
- Use exponential backoff algorithm for the next write HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boto3.