boto3 client NoRegionError: You must specify a region error only sometimes
I have a boto3 client :
But it happens on new machines, They open and close dynamically.
if endpoint is None: if region_name is None: # Raise a more specific error message that will give # better guidance to the user what needs to happen. raise NoRegionError()
Why is this happening? and why only part of the time?
One way or another you must tell boto3 which in which region you wish the
kms client to be created. This could be done explicitly using the
region_name parameter as in:
kms = boto3.client('kms', region_name='us-west-2')
or you can have a default region associated with your profile in your
~/.aws/config file as in:
or you can use an environment variable as in:
but you do need to tell boto3 which region to use.