LinuxCommandLibrary

aws-s3-presign

Generate pre-signed URLs for temporary S3 object access

TLDR

Generate a pre-signed URL with default 1-hour expiration

$ aws s3 presign s3://[bucket-name]/[file.txt]
copy
Generate a pre-signed URL valid for 1 week (maximum)
$ aws s3 presign s3://[bucket-name]/[file.txt] --expires-in 604800
copy
Generate a pre-signed URL valid for 5 minutes
$ aws s3 presign s3://[bucket-name]/[file.txt] --expires-in 300
copy
Generate a pre-signed URL for a specific region
$ aws s3 presign s3://[bucket-name]/[file.txt] --region [us-west-2]
copy

SYNOPSIS

aws s3 presign S3Uri [--expires-in value] [options]

DESCRIPTION

aws s3 presign generates a pre-signed URL for an Amazon S3 object. Anyone with the pre-signed URL can retrieve the S3 object using an HTTP GET request without AWS credentials.
Pre-signed URLs are useful for sharing private S3 objects temporarily, embedding download links in applications, or providing time-limited access to files. All pre-signed URLs use Signature Version 4 (SigV4) authentication.

PARAMETERS

S3Uri

The S3 URI of the object to generate a pre-signed URL for (s3://bucket-name/key)
--expires-in value
Number of seconds until the pre-signed URL expires (default: 3600, maximum: 604800)
--region value
The AWS region of the bucket (required for SigV4; overrides config/env settings)

CAVEATS

The maximum expiration time is 604800 seconds (7 days). The region must be configured explicitly since all pre-signed URLs use SigV4 authentication. Pre-signed URLs grant read-only access; they cannot be used to upload or modify objects. The URL expires based on the credentials used to sign it; if using temporary credentials (STS), the URL cannot outlive those credentials.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community