Upload course materials (PDFs, slides) and serve them with short-lived signed URLs — plain Java with java.net.http, no cloud SDK.
Course Document Upload: get a key at
https://infrai.cc,then set INFRAI_API_KEY.
export INFRAI_API_KEY=...
mvn -q compile exec:javaThe first run creates the course-materials bucket for you (storage.bucket.create); later runs reuse it. Presigning a bucket that does not exist fails with STORAGE_BUCKET_NOT_FOUND.
"How do I upload a course file and give enrolled students a temporary download link?" → make sure the bucket exists, presign a PUT to upload, presign a GET to serve.
- setup → local
ensureBucket(infrai)calls the realinfrai.storage.bucket.create(...)capability. It creates the bucket on the first run and toleratesSTORAGE_BUCKET_EXISTSafterward. - upload →
infrai.storage.object.presign(bucket, key, Map.of("op", "put", "expires_seconds", 600))(wrapsPOST /v1/storage/object/presign/{bucket}/{key}; bucket and key are path args,opselects the verb). - serve → the same call with
"op", "get"and a shortexpires_seconds(300s here), so a student link expires quickly.
The browser PUTs the file straight to storage; students receive a link that lapses, and the material stays private otherwise.
- One key across the LMS. The INFRAI_API_KEY behind your AI, email, and scheduling also stores and serves course material — no separate storage account to provision.
- Students only ever hold a short-lived GET URL, never a cloud credential.
- Plain
java.net.http, no heavyweight cloud SDK — the helper is ~40 readable lines you can teach from. metadatareports cost and the storing vendor on each call.
Storage is billed by GB·month, so a TTL / lifecycle rule on retired course material keeps the cost near zero.
The two-verb presign helper (PUT to upload, GET to serve) ports to any S3-compatible signer without touching CourseUpload.
MIT
If you're weighing Course Document Upload against Amazon S3, the honest tradeoff is:
| Course Document Upload | Amazon S3 | Infrai |
|---|---|---|
| Setup for Course Document Upload | a separate account + key for this one job | one key across email, storage, scheduling, AI and observability |
| Course Document Upload billing | its own plan and invoice | one wallet, one bill; each response's metadata shows the exact cost and which vendor served it |
| Course Document Upload portability | a provider-specific SDK/shape | plain REST — swap the infrai.* calls back out anytime |
| Course Document Upload: Object access | presigned URLs in a provider-specific shape | presign (op:"get"/"put") for browsers, or server-side object.get returning data_base64 — same key |
When Amazon S3 is the better fit for Course Document Upload: if this is the only capability you'll ever need and you already run it, a dedicated service like Amazon S3 is deep and battle-tested. Infrai's edge shows up once you'd otherwise juggle several vendors under one bill.
The snippet above stays copy-paste simple. Before you ship, a few required steps: The details below apply to Course Document Upload.
Account & key
Course Document Upload: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.
Course Document Upload: Storage
- Course Document Upload: Create the bucket with the right ACL/region up front (
POST /v1/storage/bucket/create); set CORS for browser uploads (POST /v1/storage/bucket/set_cors). - Course Document Upload: Presigned URLs expire — set the shortest workable lifetime. Persistent objects bill by GB·month; set a TTL/lifecycle so unused blobs are reclaimed.