omrikiei / aws_logging_handlers

AWS integration for python logging handlers(S3, Kinesis)
https://omrikiei.github.io/aws_logging_handlers/
MIT License
71 stars 27 forks source link

Default behavior should not ask for creds+region #4

Closed JonathanHuot closed 5 years ago

JonathanHuot commented 6 years ago

Hi, When building KinesisHandler/S3Handler, it asks for a key_id, a secret and a region. However, boto3 takes that automatically from .aws/credentials and $AWS_DEFAULT_REGION

I suggest to make these parameters optionals for the simplicity of the users (no need to read the file and read the environment ourselves).

omrikiei commented 6 years ago

I understand the need, I only used this library in docker containers and shared credentials in secrets. since is should be a serious change I'll try to push it soon

amsoell commented 5 years ago

Somewhat related, so I'm adding here instead of opening a new issue. It would be incredibly useful if the AWS credentials could be applied on a per-application basis, rather than read out of a global configuration file. Is that in a realm of possibility here?

omrikiei commented 5 years ago

@amsoell - handlers wrap the AWS package and can pass credentials as keyword arguments, so you can definitely pass AWS params as arguments when initializing the handler, example: s3_handler = S3Handler("test_log", bucket, workers=3, aws_access_key_id="YOUR_KEY_ID", aws_secret_access_key="YOUR_SECRET")

so you can do that and you can even initialize different handlers with different credentials..

amsoell commented 5 years ago

Oh, that's great—I had begun to work around it by setting environment variables, but this is even better. Thank you!