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)
- InvalidParameterException when starting a Textract async job for Document Analysis HOT 3
- validate_e911_address returns invalid country code HOT 2
- Validation Exception: Invalid API version when calling InvokeModel [bedrock-runtime] HOT 2
- Collaborate with AWS SDK Code Examples team
- ECS ListContainerInstances (1.34.150) - incorrect 'MaxItems' details HOT 2
- AWS Lambda - "list_coverage" filter on `lambdaFunctionRuntime` not working HOT 8
- list_protections doc does not state an optional field. HOT 3
- Converse API skips 'required' tool spec parameters HOT 2
- Dangling Parameter - should be removed from SNS Docs HOT 1
- Image corruption when uploading to S3 using Boto3 in Lambda HOT 2
- Use IAM ID instead of username HOT 1
- Example for MultipartUpload HOT 5
- Error writing records to Timestream HOT 2
- Bedrock - Add way to identify which models an account currently has access to HOT 3
- Inconsistent description of `type` response for `describe_directories` HOT 2
- Bedrock invoke_agent boto3 does not have knowledgeBaseConfigurations HOT 6
- Allow to define client_config when using boto3.setup_default_session HOT 1
- Default Value for `NextToken` in `SageMaker.Client.list_model_packages` HOT 5
- why MissingFields error is occured HOT 2
- How to invoke an API gateway rest api endpoint with credentials HOT 1
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.