Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssm connection plugin - allow s3 bucket to use it's own region setting #603

Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
description: The name of the S3 bucket used for file transfers.
vars:
- name: ansible_aws_ssm_bucket_name
bucket_region:
description: The region of the S3 bucket used for file transfers.
vars:
- name: ansible_aws_ssm_bucket_region
plugin:
description: This defines the location of the session-manager-plugin binary.
vars:
Expand Down Expand Up @@ -508,7 +512,10 @@ def _flush_stderr(self, subprocess):

def _get_url(self, client_method, bucket_name, out_path, http_method, profile_name):
''' Generate URL for get_object / put_object '''
region_name = self.get_option('region') or 'us-east-1'
try:
region_name = self.get_option('bucket_region') or self.get_option('region')
except KeyError:
region_name = 'us-east-1'
client = self._get_boto_client('s3', region_name=region_name, profile_name=profile_name)
return client.generate_presigned_url(client_method, Params={'Bucket': bucket_name, 'Key': out_path}, ExpiresIn=3600, HttpMethod=http_method)

Expand Down