From 121ae4dc8a16b9801ef28b049be4647cf697a9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhamed=20Huseinba=C5=A1i=C4=87?= Date: Mon, 7 Nov 2022 11:40:18 +0100 Subject: [PATCH] fix: always use regional S3 url --- plugins/connection/aws_ssm.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 3734d64c938..dbb7e7c3d01 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -572,11 +572,18 @@ def _get_boto_client(self, service, region_name=None, profile_name=None): if profile_name: session_args['profile_name'] = profile_name session = boto3.session.Session(**session_args) - - client = session.client( - service, - config=Config(signature_version="s3v4") - ) + + if service == 's3' and region_name: + client = session.client( + service, + endpoint_url=('https://s3.' + region_name + '.amazonaws.com'), + config=Config(signature_version="s3v4") + ) + else: + client = session.client( + service, + config=Config(signature_version="s3v4") + ) return client @_ssm_retry