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.

boto3 uses incorrect EMR service endpoint

See original GitHub issue

Here is the error thrown when attempting to use any boto3.client('emr') command in us-west-2:

Traceback (most recent call last):
  File...botocore/httpsession.py", line 287, in send
    raise ConnectTimeoutError(endpoint_url=request.url, error=e)
botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "https://us-west-2.elasticmapreduce.amazonaws.com/"

I was trying to add a step to an EMR in us-west-2 from another EMR in the same region when I began running into the botocore.exceptions.ConnectTimeoutError.

The service endpoint listed by the error message is https://us-west-2.elasticmapreduce.amazonaws.com/

AWS docs say it should be: elasticmapreduce.us-west-2.amazonaws.com doc

Here are the contents of my virtual environment:

boto3==1.12.20
botocore==1.15.20
docutils==0.15.2
fsspec==0.6.2
jmespath==0.9.5
python-dateutil==2.8.1
s3fs==0.4.0
s3transfer==0.3.3
six==1.14.0
urllib3==1.25.8

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
swetashrecommented, Mar 16, 2020

@zking1219 - Thank for your post. Can you please provide me the exact code you are running ? It would be helpful if you could provide me full debug logs. You can enable log by adding boto3.set_stream_logger('') to your code.

0reactions
bitbiercommented, May 4, 2021

In case anyone stumbles upon this, it’s actually a configuration issue in Botocore (https://github.com/boto/botocore/issues/2376). Basically, if you want to use private VPC endpoints, you’ll need to pass in the endpoint_url to use it.

>>> import boto3
>>> session = boto3.Session()
>>> endpoints = session._session.get_component("endpoint_resolver")
>>> endpoints.construct_endpoint("elasticmapreduce", "us-west-2")
OrderedDict([('partition', 'aws'), ('endpointName', 'us-west-2'), ('protocols', ['https']), ('sslCommonName', 'us-west-2.elasticmapreduce.amazonaws.com'), ('hostname', 'elasticmapreduce.us-west-2.amazonaws.com'), ('signatureVersions', ['v4']), ('dnsSuffix', 'amazonaws.com')])

The sslCommonName has the inverted region and service name.

However, it’s correct for us-east-1:

>>> endpoints.construct_endpoint("elasticmapreduce", "us-east-1")
OrderedDict([('sslCommonName', 'elasticmapreduce.us-east-1.amazonaws.com'), ('partition', 'aws'), ('endpointName', 'us-east-1'), ('protocols', ['https']), ('hostname', 'elasticmapreduce.us-east-1.amazonaws.com'), ('signatureVersions', ['v4']), ('dnsSuffix', 'amazonaws.com')])

See: https://github.com/boto/botocore/blob/develop/botocore/data/endpoints.json#L2605-L2607

Read more comments on GitHub >

github_iconTop Results From Across the Web

EMR — Boto3 Docs 1.26.33 documentation - AWS
Amazon EMR Studio redirects users to this endpoint to enter credentials. IdpRelayStateParameterName (string) -- The name that your identity provider (IdP) uses ......
Read more >
EMRContainers — Boto3 Docs 1.26.34 documentation - AWS
It is the prefix used in Amazon EMR on EKS service endpoints. ... Returns: True if the operation can be paginated, False otherwise....
Read more >
EMRServerless — Boto3 Docs 1.26.32 documentation - AWS
It is the prefix used in Amazon EMR Serverless service endpoints. ... Returns: True if the operation can be paginated, False otherwise.
Read more >
class EMR.Client - Boto 3 Docs 1.9.96 documentation
If this value is false , only the IAM user that created the cluster can view and manage it. This value can be...
Read more >
Health — Boto3 Docs 1.16.51 documentation - Amazon AWS
Use this endpoint to call the AWS Health API operations. ... This parameter specifies if the AWS Health event is a public AWS...
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