Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . s3 ]

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. For sigv4 requests the region needs to be configured explicitly.

See 'aws help' for descriptions of global parameters.

Synopsis

  presign
<S3Uri>
[--expires-in <value>]

Options

path (string)

--expires-in (integer) Number of seconds until the pre-signed URL expires. Default is 3600 seconds.

See 'aws help' for descriptions of global parameters.

Examples

To create a pre-signed URL with the default one hour lifetime that links to an object in an S3 bucket

The following presign command generates a pre-signed URL for a specified bucket and key that is valid for one hour:

aws s3 presign s3://awsexamplebucket/test2.txt

Output:

https://awsexamplebucket.s3.amazonaws.com/test2.txt?AWSAccessKeyId=AKIAEXAMPLEACCESSKEY&Signature=EXHCcBe%EXAMPLEKnz3r8O0AgEXAMPLE&Expires=1555531131

To create a pre-signed URL with a custom lifetime that links to an object in an S3 bucket

The following presign command generates a pre-signed URL for a specified bucket and key that is valid for one week:

aws s3 presign s3://awsexamplebucket/test2.txt --expires-in 604800

Output:

https://examplebucket.s3.amazonaws.com/test2.txt?AWSAccessKeyId=AKIAEXAMPLEACCESSKEY&Signature=EXHCcBe%EXAMPLEKnz3r8O0AgEXAMPLE&Expires=1556132848

For more information, see Share an Object with Others in the S3 Developer Guide guide.