in sagemaker_studio_sparkmagic_lib/utils.py [0:0]
def get_emr_endpoint_url(region):
"""
boto3 url for EMR is not constructed correctly in some regions See https://github.com/boto/botocore/issues/2376
@TODO: Deprecate after https://github.com/boto/botocore/issues/2376 is fixed
This causes issues when customer use Private Link for EMR without internet connections
As per recommendation we construct EMR endpoints to match https://docs.aws.amazon.com/general/latest/gr/emr.html
"""
sess = boto3.session.Session()
# tokenize endpoint url of format https://us-west-2.elasticmapreduce.amazonaws.com and ignore first two tokens
boto_url_tokens = sess.client("emr", region_name=region)._endpoint.host.split(".")
return f"https://elasticmapreduce.{region}.{'.'.join(boto_url_tokens[2:])}"