question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New region ap-east-1 causes issues in describe_instances

See original GitHub issue

We have ec2 instances in multiple regions. We have a scripts that fetches all our instances in all regions.

` ec2client = boto3.client(‘ec2’, region_name=‘eu-west-1’) response = ec2client.describe_regions()

for region in response[‘Regions’]: ec2client = boto3.client(‘ec2’, region_name=region[‘RegionName’]) response = ec2client.describe_instances() `

This fails since the new region in Hong Kong is open: https://aws.amazon.com/blogs/aws/now-open-aws-asia-pacific-hong-kong-region/

Note that we do not have the new region enabled. describe_regions includes it however. The documentation says ‘regions available to you’.

Error message:

botocore.hooks: DEBUG: Event before-call.ec2.DescribeInstances: calling handler <function inject_api_version_header_if_needed at 0x7fcf5faa1b90> botocore.endpoint: DEBUG: Making request for OperationModel(name=DescribeInstances) with params: {‘body’: {‘Action’: u’DescribeInstances’, ‘Version’: u’2016-11-15’}, ‘url’: u’https://ec2.ap-east-1.amazonaws.com/‘, ‘headers’: {‘Content-Type’: ‘application/x-www-form-urlencoded; charset=utf-8’, ‘User-Agent’: ‘Boto3/1.9.136 Python/2.7.12 Linux/4.4.0-146-generic Botocore/1.12.136’}, ‘context’: {‘auth_type’: None, ‘client_region’: ‘ap-east-1’, ‘has_streaming_input’: False, ‘client_config’: <botocore.config.Config object at 0x7fcf5a43a5d0>}, ‘query_string’: ‘’, ‘url_path’: ‘/’, ‘method’: u’POST’} botocore.hooks: DEBUG: Event request-created.ec2.DescribeInstances: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7fcf5a43a590>> botocore.hooks: DEBUG: Event choose-signer.ec2.DescribeInstances: calling handler <function set_operation_specific_signer at 0x7fcf5fa9f320> botocore.auth: DEBUG: Calculating signature using v4 auth. botocore.auth: DEBUG: CanonicalRequest: POST /

content-type:application/x-www-form-urlencoded; charset=utf-8 host:ec2.ap-east-1.amazonaws.com x-amz-date:20190426T090746Z

content-type;host;x-amz-date 6171eb09865e32b0602af0f7957e26573a51f53caaedff02ff88883cb0275885 botocore.auth: DEBUG: StringToSign: AWS4-HMAC-SHA256 20190426T090746Z 20190426/ap-east-1/ec2/aws4_request 4dba02c467b70e85d9856c14730f7e21bd85df96af3df7a495901cc429b79a8b botocore.auth: DEBUG: Signature: 41370e62e65a0d3178d4e7990a89faedc26bbbbecc392204819aace2597f15ad botocore.endpoint: DEBUG: Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://ec2.ap-east-1.amazonaws.com/, headers={‘Content-Length’: ‘43’, ‘Content-Type’: ‘application/x-www-form-urlencoded; charset=utf-8’, ‘Authorization’: ‘AWS4-HMAC-SHA256 Credential=AKIAI6HSHCH6N3HC2RIA/20190426/ap-east-1/ec2/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=41370e62e65a0d3178d4e7990a89faedc26bbbbecc392204819aace2597f15ad’, ‘X-Amz-Date’: ‘20190426T090746Z’, ‘User-Agent’: ‘Boto3/1.9.136 Python/2.7.12 Linux/4.4.0-146-generic Botocore/1.12.136’}> urllib3.util.retry: DEBUG: Converted retries value: False -> Retry(total=False, connect=None, read=None, redirect=0, status=None) urllib3.connectionpool: DEBUG: Starting new HTTPS connection (1): ec2.ap-east-1.amazonaws.com:443 urllib3.connectionpool: DEBUG: https://ec2.ap-east-1.amazonaws.com:443 “POST / HTTP/1.1” 401 None botocore.parsers: DEBUG: Response headers: {‘Transfer-Encoding’: ‘chunked’, ‘Date’: ‘Fri, 26 Apr 2019 09:07:47 GMT’, ‘Server’: ‘AmazonEC2’} botocore.parsers: DEBUG: Response body:

<?xml version="1.0" encoding="UTF-8"?>

<Response><Errors><Error>AuthFailure<Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>9b981b0f-930f-48e7-baab-8914d0834889</RequestID></Response>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
SpenGietzcommented, May 28, 2019

Is there a potential fix for this when using boto3.session.Session().get_available_regions? I’m running into errors with services that don’t have a describe_regions API call.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DescribeInstances - Amazon Elastic Compute Cloud
Describes the specified instances or all instances. If you specify instance IDs, the output includes information for only the specified instances.
Read more >
AWS Python boto3 describe all instances in all regions and ...
I'm starting using boto3 and I wonder how I can get an inventory of all ec2 instances in all regions with custom attributes...
Read more >
Save yourself a lot of pain (and money) by choosing your AWS ...
If most of your users access your applications from within North America, then it typically makes sense to deploy your software in an...
Read more >
Checking if a region is enabled using the AWS API. - Cloudar
UPDATE: AWS added a way to see the regional status to the ec2 api. ... the new AWS region in Hong Kong, ap-east-1,...
Read more >
describe-instances — AWS CLI 2.9.8 Command Reference
If you describe instances in the rare case where an Availability Zone is ... reason - The reason for the current state of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found