Closed ryandub closed 5 years ago
i'm also interested in library usage. but i think its a little cleaner is instead parameterizing use of resources across around a session factory, so the additional client can be created as needed, without having to refetch credential info from a particular entry point.
Confirming the @ryandub commits working, tested, see example below. Although not ideal (as mentioned by @kapilt, I'd vote for merging this one, to allow for programmatic usage. Maybe not advertise it as official api, to allow changing it later to proper, more elegant way.
Test:
skew_creds={'aws_access_key_id': 'ZZZZZZZZZZZZZZZZZZ', 'aws_secret_access_key': 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'}
skew.config._config = {'accounts': {'111111111111111111': {'credentials': skew_creds}}}
arn = scan('arn:aws:ec2:us-east-2:111111111111111111:vpc/*')
I am interested in using it programmatically specifically in a lambda function. This will make it much easier to read account credentials from environment variables and configure skew accordingly. When will it be merged?
Thank you for adding the functionality. I will be making the same modification in the code to get it working.
When will it be released on PYPI? Keeping the old version as a requirement might create problems when redeploying. On the other hand is there a way to add this override it, without modifying the library code.
You can specify the version explicitly from Git: https://stackoverflow.com/a/35998253
The current configuration instantiation for skew makes it a bit challenging to use it programmatically as a library. This change allows someone to load AWS credentials into the
skew.config._config
like so:Without this change, you can inject
aws_creds
intoskew.scan()
and those kwargs get passed all the way down until you start to iterate resources, at which point things like https://github.com/scopely-devops/skew/blob/develop/skew/resources/aws/__init__.py#L106-L109 attempt to create a new client without the kwargs and things break. :)Thanks for making this!