Skip to content

Commit

Permalink
Fix detection of ssm connction bucket region by ensuring that the bot…
Browse files Browse the repository at this point in the history
…o client is created normally and able to use supported credential sources
  • Loading branch information
Geoffrey Hichborn committed Aug 30, 2022
1 parent cb9716e commit 929e956
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,14 @@ def _flush_stderr(self, subprocess):
def _get_url(self, client_method, bucket_name, out_path, http_method, profile_name, extra_args=None):
''' Generate URL for get_object / put_object '''

bucket_location = boto3.client('s3').get_bucket_location(
region_name = self.get_option('region') or 'us-east-1'

bucket_location = self._get_boto_client('s3', region_name=region_name, profile_name=profile_name).get_bucket_location(
Bucket=(self.get_option('bucket_name')),
)
region_name = bucket_location['LocationConstraint']
bucket_region_name = bucket_location['LocationConstraint']

client = self._get_boto_client('s3', region_name=region_name, profile_name=profile_name)
client = self._get_boto_client('s3', region_name=bucket_region_name, profile_name=profile_name)
params = {'Bucket': bucket_name, 'Key': out_path}
if extra_args is not None:
params.update(extra_args)
Expand Down

0 comments on commit 929e956

Please sign in to comment.