Closed acidbotmaker closed 2 years ago
perhaps via the "profile" parameter in botocore/session.py?
A PR would be awesome if this is still an issue! (if not please close)
Btw if you have the AWS credentials in an .env
file you can just source
it before you run the listener itself:
source .env && python listener.py
@raminsj13 since the listener relies on boto
for resolving credentials, just setting the AWS_PROFILE
environment variable should allow you to choose the profile you want to use for the listener. Have you tried that?
@jegesh your code forces the default session to be an IAM role rather than allowing it to use files.
@jegesh would a better, and easier, solution to be just change the SqsListener object to take the boto3 session object as constructor parameter? Allows the user to decide how to initialize the AWS connection, which is probably how it should be. I can't think of a reason why the package should care how the connection is established.
To keep it backwards compatible, it could be passed in the kwargs object and default to current path if not available.
I forked the project, if there's interest
Is it possible to add feature to use aws credentials from either .env file or in constructor?