What Is an S3 Presigned URL, and When Do You Need One?

by 9 min read
Opndrive logo above the title "What Is an S3 Presigned URL, and When Do You Need One?" on a blue background
On this page

To share one private file without giving away your keys or opening the bucket, use a presigned URL.

Short answer: A presigned URL is an ordinary link to one file in a private bucket, with a signature and an expiry time added to it. Anyone who has the link can download that file (or, with an upload link, upload it) until the expiry passes, without keys of their own, and the bucket stays private. Make one on your own machine whenever a person or a browser needs one file for a short time.

Shell
aws s3 presign s3://my-bucket/report.pdf --expires-in 3600
https://s3.example.com/my-bucket/report.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=YOUR_ACCESS_KEY_ID%2F20261203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20261203T192249Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=5ea4b1547b75a1388490b31406a3bb5296284f09387092f57fd2a10c7d8d5090

The output differs by server; above is MinIO’s.

It signs a one-hour link with your AWS CLI keys, on your machine; the bucket hears nothing until someone opens the link.[1] The AWS CLI is Amazon’s command-line tool. It needs your keys, the access key ID and secret that act as your bucket login. For any server other than Amazon S3, and for S3 Regions launched after March 20, 2019, add --endpoint-url <your-endpoint> to every aws s3 command, aws s3 ls included.[2][3]

How we tested: We ran the commands in this post on MinIO RELEASE.2025-07-23T15-54-02Z, SeaweedFS 4.52, Garage 2.6.0 and RustFS 1.0.7 on 4 Dec 2026. Each server got a fresh test bucket (my-bucket in the commands) holding one small text file saved as report.pdf at the top of the bucket, deleted after the run. The output under a command is MinIO’s; where a server printed something else, the note under it says so.

What we read rather than ran: How Amazon S3, Cloudflare R2 and Backblaze B2 handle these links, including temporary credentials and upload rules, comes from their documentation.

A presigned URL is a normal request for one file, written out as a link with its proof of permission in the query string (the text after the ?).[4] A bucket is a storage container. Each file in it is an object, named by its key (its path in the bucket). On Amazon S3, objects are private by default.[3]

Signing happens on your machine: your tool mixes the request with your secret access key into a code, the signature. It adds that code to the link.[1] When someone opens the link, the bucket recomputes the signature, checks the time and answers with the signer’s permissions.[4] Whoever holds the link can use it.[1]

You sign a link on your machine and pass it on; the bucket checks signature and expiry only when it is opened
Signing never contacts the bucket. The check happens when someone opens the link.

A script on a web page also needs a CORS rule on the bucket (the browser’s cross-site check). Our CORS guide shows how.

Sign each link right before you need it, and give it the shortest life that covers the job. Use a key that can read only that bucket: for download links, s3:GetObject on that bucket or prefix is enough.[1] A short life and a narrow key limit a leak.[1]

Does a presigned URL make the bucket public?

No. The link allows one operation on one object, and only while it is valid; every other object stays private.[5] A public bucket is the opposite: anyone can read every object in it.[6]

The catch: the link is the permission. It works any number of times before the expiry passes.[1] Cutting access short is covered in how to take a shared link back before it expires.

Opndrive, a web file manager for S3-compatible buckets, makes the same kind of link without a command line:

  1. Select a file, open More actions, then Share.
  2. Pick 1 hour, then Generate Link. A long link appears, with a copy button.

A file's More actions menu with Share between Download and Rename
Open More actions on the file’s row, then choose Share (shown on a demo file).

The Share file dialog with the Link expires in setting above the Generate Link button
Set how long the link lasts here, then click Generate Link.

Print a link with each part on its own line:

Shell
aws s3 presign s3://my-bucket/report.pdf --expires-in 3600 | tr '?&' '\n\n'
https://s3.example.com/my-bucket/report.pdf
X-Amz-Algorithm=AWS4-HMAC-SHA256
X-Amz-Credential=YOUR_ACCESS_KEY_ID%2F20261203%2Fus-east-1%2Fs3%2Faws4_request
X-Amz-Date=20261203T192249Z
X-Amz-Expires=3600
X-Amz-SignedHeaders=host
X-Amz-Signature=5ea4b1547b75a1388490b31406a3bb5296284f09387092f57fd2a10c7d8d5090

Tested on MinIO.

Part What it does
Path, /my-bucket/report.pdf The one file; signed, so it can’t be swapped
X-Amz-Algorithm AWS4-HMAC-SHA256, meaning SigV4 (Signature Version 4), the signing method S3-compatible servers share[4]
X-Amz-Credential Your access key ID, plus the date, region and service it is valid for
X-Amz-Date The signing time (UTC), when the expiry clock starts
X-Amz-Expires Seconds the link lasts: 1 to 604,800 (seven days)
X-Amz-SignedHeaders Signed headers, usually only host, so the link works at one address
X-Amz-Signature The signature over everything else; any edit breaks it
X-Amz-Security-Token Only present when temporary keys signed the link

The link shows your access key ID, never your secret key. The host entry is why a link signed for an address the recipient can’t reach fails.

This script prints the HTTP status and error code for four links: untouched, expiry edited from 60 to 600 seconds, expired, and pointing at a missing file. A link to a missing file is still created, because signing never asks the bucket.[1]

Shell
check() {
  status=$(curl -s -o answer.xml -w '%{http_code}' "$2")
  code=$(sed -n 's:.*<Code>\(.*\)</Code>.*:\1:p' answer.xml)
  echo "$1: status=$status code=${code:--}"
}

url=$(aws s3 presign s3://my-bucket/report.pdf --expires-in 60)
check valid "$url"
check edited "$(echo "$url" | sed 's/X-Amz-Expires=60&/X-Amz-Expires=600\&/')"

short=$(aws s3 presign s3://my-bucket/report.pdf --expires-in 1)
sleep 3
check expired "$short"

check missing "$(aws s3 presign s3://my-bucket/no-such-file.pdf --expires-in 60)"
valid: status=200 code=-
edited: status=403 code=SignatureDoesNotMatch
expired: status=403 code=AccessDenied
missing: status=404 code=NoSuchKey

Lines 2 and 3 differ by server, as the comparison of their results shows.

How the servers answered:

Server Valid link Edited link Expired link Missing file
MinIO 200 SignatureDoesNotMatch AccessDenied NoSuchKey
SeaweedFS 200 SignatureDoesNotMatch AccessDenied NoSuchKey
Garage 200 AccessDenied InvalidRequest NoSuchKey
RustFS 200 SignatureDoesNotMatch AccessDenied NoSuchKey

Valid link is the HTTP status (200 means the file came back); the other columns are each error’s <Code>. SignatureDoesNotMatch means the server caught the edit. Names vary: Cloudflare R2 answers an expired link with ExpiredRequest,[6] so code that handles refusals should check the HTTP status first.

One link does one job: the HTTP method (GET downloads, PUT uploads) is fixed when you sign.[1] An upload link writes the file at the signed key and replaces any file already there.

aws s3 presign makes only download links,[2] so upload links come from an SDK, a code library for your language.

If you sign the Content-Type header, the upload must send exactly that type. On Cloudflare R2 a mismatch fails with 403 SignatureDoesNotMatch.[5] That checks only the header, not the uploaded bytes (presigned URLs sign UNSIGNED-PAYLOAD, not the file body).[4] So scan uploads if the contents matter.

boto3, the AWS SDK for Python, signs upload links. Install it:

Shell
pip install boto3

Save this as presign_upload.py, with your own endpoint, region and bucket. On Amazon S3 in a standard Region, leave out endpoint_url:

Python
import boto3
from botocore.config import Config
from botocore.exceptions import BotoCoreError, ClientError

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3.example.com",
    region_name="us-east-1",
    config=Config(signature_version="s3v4"),
)

try:
    url = s3.generate_presigned_url(
        "put_object",
        Params={"Bucket": "my-bucket", "Key": "uploads/report.pdf",
                "ContentType": "application/pdf"},
        ExpiresIn=600,
    )
except (BotoCoreError, ClientError) as err:
    raise SystemExit(f"Could not sign the upload link: {err}")

print(url)
https://s3.example.com/my-bucket/uploads/report.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=YOUR_ACCESS_KEY_ID%2F20261203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20261203T192255Z&X-Amz-Expires=600&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Signature=9282a772a7a1ab0beb5d10a15ea265ceddea95556bc585aecd04d4756fb8e6b6

The output differs by server; above is MinIO’s.

The Config line asks for SigV4. boto3’s documentation warns that presigned URLs otherwise use the older Signature Version 2 in some regions, which leaves some parameters unsigned. Upload with the link, then list the folder:

Shell
UPLOAD_URL=$(python3 presign_upload.py)
curl -s -o /dev/null -w '%{http_code}\n' -X PUT -T report.pdf \
  -H "Content-Type: application/pdf" "$UPLOAD_URL"
aws s3 ls s3://my-bucket/uploads/
200
2026-12-03 19:22:55         10 report.pdf

Line 2 differs by server:

Server Line 2
MinIO 2026-12-03 19:22:55 10 report.pdf
SeaweedFS 2026-12-03 19:23:02 10 report.pdf
Garage 2026-12-03 19:23:09 10 report.pdf
RustFS 2026-12-03 19:23:15 10 report.pdf

Look for status 200 and report.pdf in the listing.

A presigned URL stops at its own expiry or its signing key’s, whichever comes first

A link lives for the shorter of its own expiry and the life of the key that signed it.[1] Temporary credentials are keys that expire on their own, such as the short-lived keys an app gets from the AWS call AssumeRole. They take their links with them, and AWS then reports ExpiredToken. An AssumeRole session lasts 1 hour by default. So a seven-day link needs a long-lived key from an IAM user (an AWS identity for one person or app).

Other causes: a short default, such as the JavaScript SDK’s 900 seconds,[7] a wrong clock on the signing machine, or a proxy that rewrites the link.[1]

When this doesn’t fit: a backend or a CDN instead

To scan uploads or check who downloads, route the traffic through your own backend, which then carries every byte. For many private files at once, a CDN (servers that deliver files near the reader) with signed cookies fits better. The cost is one more service.[8]

References

  1. Download and upload objects with presigned URLs – Amazon S3
  2. presign – AWS CLI Command Reference
  3. Sharing objects with presigned URLs – Amazon S3
  4. Authenticating requests: using query parameters (SigV4) – Amazon S3
  5. Presigned URLs – Cloudflare R2
  6. Configure CORS – Cloudflare R2
  7. @aws-sdk/s3-request-presigner README
  8. Decide to use signed URLs or signed cookies – Amazon CloudFront

Try Opndrive

Opndrive gives any S3-compatible bucket a Drive-like web interface you host yourself.
See it on GitHub or read the docs.

Curious about Opndrive?

Take a look at our FAQ to learn more.

Opndrive

Ready to take control of your S3 storage?

Connect your S3 bucket in minutes and start managing your files with Opndrive's beautiful, modern interface.

Build Opndrive with us

Live demos, reviews on your PRs, and a hand when you get stuck.

Be an early member
Join our Discord