CmdID

CmdID / aws / aws s3

aws s3 presign

Generate a pre-signed URL for an Amazon S3 object. AWS CLI reference

2 examples 1 option Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

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

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

aws s3 presign s3://amzn-s3-demo-bucket/test2.txtIdentify
Its output
https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAEXAMPLE123456789%2F20210621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210621T041609Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=EXAMPLE1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456

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

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

aws s3 presign s3://amzn-s3-demo-bucket/test2.txt --expires-in 604800Identify
--expires-inNumber of seconds until the pre-signed URL expires.
Its output
https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAEXAMPLE123456789%2F20210621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210621T041609Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=EXAMPLE1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456

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

Options

1 in the AWS CLI reference
--expires-inNumber of seconds until the pre-signed URL expires.