Skip to content

Commit 0b43920

Browse files
committed
add explicit setting for aws region from environment variables
1 parent 5260e90 commit 0b43920

File tree

1 file changed

+5
-1
lines changed
  • aws-opentelemetry-distro/src/amazon/opentelemetry/distro

1 file changed

+5
-1
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ def get_aws_session():
4646
# pylint: disable=import-outside-toplevel
4747
from botocore.session import Session
4848

49-
return Session()
49+
session = Session()
50+
region = os.environ.get("AWS_REGION") or os.environ.get("AWS_DEFAULT_REGION")
51+
if region:
52+
session.set_config_variable("region", region)
53+
return session
5054
return None
5155

5256

0 commit comments

Comments
 (0)