Back

Blog details

Generating Presigned URLs on AIOZ Storage with Python

AIOZ Network
7 min readAugust 09, 2026
aioz-storage
AIOZ Storage cover: Presigned URLs with Python

To generate a presigned URL on AIOZ Storage with Python, call boto3's generate_presigned_url on a client pointed at https://s3.aiozstorage.network. The link lets someone download or upload one object without your keys, and it stops working after ExpiresIn seconds.

TL;DR:

  • generate_presigned_url("get_object", ...) makes a temporary download link; "put_object" makes a temporary upload link.
  • Signing happens on your machine, so presigned URLs work on AIOZ Storage as they do on S3. You need the AIOZ endpoint and path-style addressing, because bucket subdomains don't resolve.
  • Set signature_version="s3v4". In our Oct 28, 2026 test, boto3 1.43.107 produced older SigV2-style URLs without it, and the endpoint rejected SigV4 URLs that asked for more than 604,800 seconds (7 days).
  • A signed Content-Type must match the upload exactly, or the request fails with SignatureDoesNotMatch.

Updated Oct 28, 2026: shorter opening, a SigV4 setting, real output from a fake-key test, a curl upload example, a flow diagram, and a corrected answer on revoking URLs.

Do Presigned URLs Work on AIOZ Storage the Same Way as on S3?

Yes. Generating a presigned URL is a signing step on your side, with no call to the server. boto3 computes a signature from your secret key and puts it in the URL's query string. AIOZ Storage then checks that signature when the URL is used, the same way Amazon S3 does.

Two settings make the URL usable. The client needs AIOZ Storage's endpoint, and it needs path-style addressing, because <bucket>.s3.aiozstorage.network has no DNS record. With path style, the bucket name goes in the path: https://s3.aiozstorage.network/your-bucket/report.pdf.

Setting Up the Client

import boto3
from botocore.config import Config

s3_client = boto3.client(
    "s3",
    region_name="us-east-1",
    endpoint_url="https://s3.aiozstorage.network",
    aws_access_key_id="<your-aioz-storage-access-key-id>",
    aws_secret_access_key="<your-aioz-storage-secret-access-key>",
    config=Config(
        signature_version="s3v4",
        request_checksum_calculation="when_required",
        response_checksum_validation="when_required",
        s3={"addressing_style": "path"},
    ),
)

The region, endpoint and path style match AIOZ's Python SDK page. We added three settings. signature_version="s3v4" gives you the SigV4 URL format and 7-day limit that AWS documents. The two checksum settings matter if you also upload through this client. Since 1.36.0, boto3 sends uploads chunked by default, and AIOZ Storage needs a Content-Length header (we confirmed that on Oct 19, 2026; see AWS's data integrity settings). Presigned URLs themselves don't carry that default checksum, because botocore skips it for presigned requests.

Generating a Presigned Download URL

url = s3_client.generate_presigned_url(
    "get_object",
    Params={"Bucket": "your-bucket", "Key": "report.pdf"},
    ExpiresIn=600,
)
print(url)

We ran this with a fake access key on Oct 28, 2026 (boto3 1.43.107), since no AIOZ credentials exist on our test machine. Signing works offline, so the output is real:

https://s3.aiozstorage.network/your-bucket/report.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEACCESSKEYEXAMPLE%2F20261028%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20261028T055843Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=b2f7b37b7edca69c38d19122caf0744481a27a7d1e0d6fd903bcbf776d0cf2ae

You can read the whole grant in the query string: the key ID and date in X-Amz-Credential, the 600-second window in X-Amz-Expires, and the signature at the end. Anyone with the link can download that one object until it expires, and nothing else in the bucket. Without signature_version="s3v4", the same call gave us a SigV2-style URL instead, with AWSAccessKeyId, Signature and an absolute Expires timestamp.

Diagram of a presigned URL flow on AIOZ Storage: the backend signs bucket, key, operation and expiry with keys from an access grant, the browser uses only the URL, and AIOZ Storage checks the signature and rejects X-Amz-Expires over 604800 seconds
Who holds what when you hand out a presigned URL. Sources: AIOZ Storage docs, AWS, and our Oct 28, 2026 fake-key test.

Generating a Presigned Upload URL

url = s3_client.generate_presigned_url(
    "put_object",
    Params={"Bucket": "your-bucket", "Key": "photo.jpg", "ContentType": "image/jpeg"},
    ExpiresIn=900,
)

The operation name changes to put_object, and so does what the URL is good for. A client can PUT a file to that URL and it lands in your bucket at that key, without touching your application server or holding your keys. That's the usual pattern for uploads straight from a browser: your backend creates the URL, and the browser sends the file.

From a terminal, the upload is a single curl command. --upload-file sends the file as a PUT with a Content-Length header, which AIOZ Storage requires on uploads:

curl --upload-file photo.jpg -H "Content-Type: image/jpeg" "$PRESIGNED_URL"

We ran the same upload with the short form -T on Oct 28, 2026, against a SigV4 URL signed with a fake key, and curl sent Content-Length: 5 for our 5-byte test file. The endpoint answered 403 InvalidAccessKeyId, so the request passed the length check and failed only on the key.

One AIOZ-specific point: AIOZ Storage has no object versioning, so a PUT URL for a key that already exists replaces that object. If you hand upload URLs to users, give each upload its own key, for example with a UUID or a date prefix.

Why Does a Presigned Upload Fail With SignatureDoesNotMatch?

Usually because of Content-Type. If you include ContentType when you create the URL, the client's PUT has to send exactly the same Content-Type header. That's how S3-style signing works everywhere, not an AIOZ quirk: every parameter you sign becomes part of what the server checks, and any mismatch breaks the signature.

So the URL above needs Content-Type: image/jpeg on the PUT. image/jpg fails, and so does a missing header. If you don't need to restrict the content type, leave ContentType out of Params. A wrong value fails, while a value you never signed isn't checked.

How Long Should ExpiresIn Be?

Shorter than feels convenient. AIOZ's own file-manager tutorial uses 600 seconds and warns, "If you set too long, it will not be secured." For a link a user clicks right away, 300 to 900 seconds is plenty. An upload from a slow connection needs more headroom, but there's a ceiling. AWS's CLI reference lists 604,800 seconds as the maximum. AWS's S3 guide says IAM user credentials are valid "up to 7 days when you're using AWS Signature Version 4."

AIOZ Storage enforces the same limit for SigV4 URLs. boto3 itself accepted ExpiresIn=604801, so the check happens on the server. These are the responses we got from s3.aiozstorage.network on Oct 28, 2026, using a fake key:

URL we sentResponse
SigV2-style GET (boto3 default with this config)403 InvalidAccessKeyId
SigV4 GET, X-Amz-Expires=600403 InvalidAccessKeyId
SigV4 GET, X-Amz-Expires=604800403 InvalidAccessKeyId
SigV4 GET, X-Amz-Expires=604801400 AuthorizationQueryParametersError: "X-Amz-Expires must be less than a week (in seconds)"

InvalidAccessKeyId means the request got as far as the key check, which our fake key failed. The 604,801-second URL was rejected before that. A full download or upload with real keys is still untested.

How AIOZ Storage Handles It

Sharing is one layer of object storage security, and AIOZ Storage gives you three ways to do it. A public bucket opens every object to anyone with the URL. An access grant gives a person or a script its own keys for one bucket, with Read, Write, List or Delete and an end date. A presigned URL sits in between: it's signed with a grant's keys but opens one object, for one operation, for a few minutes. Our guide to public vs private buckets covers what a public bucket exposes before you choose one.

AIOZ's Create A File Manager tutorial, which our FastAPI and boto3 walkthrough builds on, uses a presigned URL in its download endpoint:

presigned_url = s3_resource.meta.client.generate_presigned_url(
    "get_object",
    Params={"Bucket": bucket_name, "Key": file_name},
    ExpiresIn=EXPIRATION_TIME,
)

On S3, AWS says a presigned URL also "expires when the credential you used to create it is revoked, deleted, or deactivated." On AIOZ Storage, the matching step is deleting the access grant whose keys signed the URL. We expect that to cut the URL off, but we haven't tested it with real keys.

What the docs don't cover yet (checked Oct 28, 2026): presigned upload (PUT) URLs, which signature version to use, and the maximum expiry. The tutorial shows only download links. For the full example, see AIOZ's Create A File Manager tutorial.

Frequently Asked Questions

What boto3 method generates a presigned URL for AIOZ Storage?
generate_presigned_url, with "get_object" for a download link or "put_object" for an upload link, on a client set to AIOZ Storage's endpoint with path-style addressing.

Do presigned URLs need any AIOZ-specific settings?
Only the endpoint and path style. We also recommend signature_version="s3v4", and the two when_required checksum settings if the same client uploads files.

Can I revoke a presigned URL before it expires?
There's no call to cancel a single URL. On S3, it stops working when the signing credential is revoked or deleted; on AIOZ Storage that would mean deleting the access grant, which we haven't tested with real keys.

What's the maximum expiration time for a presigned URL on AIOZ Storage?
604,800 seconds (7 days) for SigV4 URLs. In our Oct 28, 2026 test the endpoint rejected 604,801 seconds with AuthorizationQueryParametersError.

Can someone use a presigned upload URL to write a different file?
No. The URL is signed for one bucket and key. It can replace the object at that key, though, because AIOZ Storage has no versioning.

Why does my presigned upload URL fail with SignatureDoesNotMatch?
Usually a Content-Type mismatch. If you signed a ContentType, the PUT must send exactly that header value.

Is a presigned URL the same thing as an access grant?
No. An access grant is a set of keys for one bucket with chosen permissions and an end date. A presigned URL is signed with those keys and covers one operation on one object.

References

We only send updates when meaningful changes ship, and you can unsubscribe anytime

Related Content

blog thumbnail

Full vs Incremental vs Differential Backup Types Explained

Full vs incremental vs differential backup: what each run copies, how restore chains work, storage and time trade-offs, synthetic fulls and RPO/RTO fit.

aioz-storage
8 min readDecember 04, 2026
blog thumbnail

RAID vs Erasure Coding: Two Ways to Survive Disk Failure

RAID vs erasure coding: RAID guards the disks of one array, while erasure coding spreads k data and m parity pieces over nodes. Compare overhead and rebuilds.

aioz-storage
9 min readDecember 01, 2026
blog thumbnail

What Is Reed-Solomon Coding? The Math Behind Erasure Codes

Reed-Solomon coding turns k data pieces into n, and any k of them rebuild the original. See the polynomial math, GF(2^8), a demo and how AIOZ Storage uses it.

aioz-storage
7 min readNovember 27, 2026
blog thumbnail

RPO vs RTO Explained, With Backup and Restore Examples

RPO vs RTO: RPO caps how much data you can lose, RTO caps how long you can stay down. See how to calculate both, MTD, and the DR strategies that meet them.

aioz-storage
7 min readNovember 24, 2026
blog thumbnail

What Is AWS Signature Version 4? How S3 Requests Are Signed

AWS Signature Version 4 signs each S3 request with an HMAC key derived from your secret. See the four steps, a worked example and the errors that break it.

aioz-storage
7 min readNovember 20, 2026
blog thumbnail

Encryption at Rest vs in Transit, and What Each Protects

Encryption at rest vs in transit: at rest guards stored bytes from stolen disks, in transit guards requests on the network with TLS. See what each one misses.

aioz-storage
7 min readNovember 17, 2026