k8s-sqs-autoscaler
k8s-sqs-autoscaler copied to clipboard
You must specify a region .. though I have it specified `--aws_region=us-west-2`
I am getting following error though I have specified the region with --aws_region=us-west-2
parameter
{'sqs_queue_url': 'https://sqs.******.amazonaws.com/********/********', 'kubernetes_deployment': 'torpid-alligator', 'kubernetes_namespace': 'default', 'aws_region': 'us-west-2', 'poll_period': 10, 'scale_down_cool_down': 30, 'scale_up_cool_down': 10, 'scale_up_messages': 20, 'scale_down_messages': 10, 'max_pods': 5, 'min_pods': 1}
Traceback (most recent call last):
File "./k8s-sqs-autoscaler", line 71, in <module>
sqs.run(options)
File "/usr/src/app/sqs/sqs.py", line 95, in run
SQSPoller(options).run()
File "/usr/src/app/sqs/sqs.py", line 16, in __init__
self.sqs_client = boto3.client('sqs')
File "/usr/local/lib/python3.6/site-packages/boto3/__init__.py", line 83, in client
return _get_default_session().client(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/boto3/session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "/usr/local/lib/python3.6/site-packages/botocore/session.py", line 861, in create_client
client_config=config, api_version=api_version)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 76, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 295, in _get_client_args
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/usr/local/lib/python3.6/site-packages/botocore/args.py", line 45, in get_client_args
endpoint_url, is_secure, scoped_config)
File "/usr/local/lib/python3.6/site-packages/botocore/args.py", line 111, in compute_client_args
service_name, region_name, endpoint_url, is_secure)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 368, in resolve
service_name, region_name)
File "/usr/local/lib/python3.6/site-packages/botocore/regions.py", line 122, in construct_endpoint
partition, service_name, region_name)
File "/usr/local/lib/python3.6/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.```
@harshadyeola I ran into this as well. The fix is to add an additional environment variable (AWS_DEFAULT_REGION
) to the deployment. e.g.:
template:
spec:
containers:
env:
- name: AWS_DEFAULT_REGION
value: us-east-1