You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say we have app runing in ECS(lots of gunicorn workers) using IAM role and want to reuse botocore session for all boto3 clients to not query for credentials each time and to not hit throttling limits with botocore.credentials.ContainerProvider:
it will be setting region variable for botocore_session multiple times and last one ap-northeast-1 will become new region of default session, so any new boto3 client without explicitly set region_name will be created for this region e.g.
instead without modifying default botocore session and achieving same result.
Please let me know if I miss the reason for actually setting region_name for a session as it is right now or use KMSMasterKeyProvider incorrectly otherwise please consider adding this change to KMSMasterKeyProvider.
The text was updated successfully, but these errors were encountered:
Thanks for finding this, @polamayster. That is definitely not the behavior we intended.
I think that the right solution for us is to do what you suggested and move the region specification to the client rather than the boto3 session.
This behavior is sufficiently magic that it makes me wonder if this was the intended behavior for the boto3 session, though, so I'm also going to open an issue with that project making sure that this is intentional.
Let's say we have app runing in ECS(lots of gunicorn workers) using IAM role and want to reuse botocore session for all boto3 clients to not query for credentials each time and to not hit throttling limits with botocore.credentials.ContainerProvider:
Code at https://github.com/aws/aws-encryption-sdk-python/blob/master/src/aws_encryption_sdk/key_providers/kms.py#L164
will end up doing this inside
boto3.session
:basically modifying botocore session for each unique region in
key_ids
supplied toKMSMasterKeyProvider
for example:it will be setting region variable for botocore_session multiple times and last one
ap-northeast-1
will become new region of default session, so any new boto3 client without explicitly set region_name will be created for this region e.g.which is not desired behavior and of course could be fixed by setting
region_name
explicitly (everywhere) but could be fixed more easily by:instead without modifying default botocore session and achieving same result.
Please let me know if I miss the reason for actually setting region_name for a session as it is right now or use KMSMasterKeyProvider incorrectly otherwise please consider adding this change to KMSMasterKeyProvider.
The text was updated successfully, but these errors were encountered: