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

Allow any S3 verb when creating pre-signed URL #8864

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Changes from all 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
12 changes: 8 additions & 4 deletions awscli/customizations/s3/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,8 @@ class PresignCommand(S3Command):
NAME = 'presign'
DESCRIPTION = (
"Generate a pre-signed URL for an Amazon S3 object. This allows "
"anyone who receives the pre-signed URL to retrieve the S3 object "
"with an HTTP GET request. All presigned URL's now use sigv4 "
"anyone who receives the pre-signed URL to interact with the S3 object "
"with an HTTP request. All presigned URL's now use sigv4 "
"so the region needs to be configured explicitly."
)
USAGE = "<S3Uri>"
Expand All @@ -709,7 +709,11 @@ class PresignCommand(S3Command):
'cli_type_name': 'integer',
'help_text': (
'Number of seconds until the pre-signed '
'URL expires. Default is 3600 seconds. Maximum is 604800 seconds.')}]
'URL expires. Default is 3600 seconds. Maximum is 604800 seconds.')},
{'name': 'verb', 'default': 'get',
'cli_type_name': 'string',
'help_text': (
'HTTP verb to allow for the pre-signed URL.')}]

def _run_main(self, parsed_args, parsed_globals):
super(PresignCommand, self)._run_main(parsed_args, parsed_globals)
Expand All @@ -718,7 +722,7 @@ def _run_main(self, parsed_args, parsed_globals):
path = path[5:]
bucket, key = find_bucket_key(path)
url = self.client.generate_presigned_url(
'get_object',
f'{parsed_args.verb.lower()}_object',
{'Bucket': bucket, 'Key': key},
ExpiresIn=parsed_args.expires_in
)
Expand Down
Loading