File Sharing App With S3 Presigned URLs
Part of the AWS Roadmap
In short
This project is a mini Google Drive: users upload and download files, yet your bucket is never public and your server never touches the file bytes. It's exactly the pattern real apps use for documents, photos and reports.
A small project where users upload and download files through short-lived presigned URLs generated by a backend, while the bucket stays fully private with Block Public Access, encryption and a lifecycle rule for old files.

Think of it like this
A courier locker at the station
Parcel lockers at a metro station are locked boxes. The courier app sends you a one-time code valid for a few hours, you open your locker, take the parcel, and the code dies. The lockers are never left open for everyone.
Watch it happen
The app's moving parts
1/5A simple page with a file picker and a list of the user's files.
The big ideas
What you need to know
Private by default
Block Public Access on, no public bucket policy, encryption on. Only presigned URLs open single objects.
Backend owns the keys
The API decides object keys, so users can't overwrite each other's files.
CORS rule
Allow PUT and GET from your site's origin only, so browsers can talk to the bucket.
Lifecycle expiry
Expire objects under uploads/ after 30 days, and expire noncurrent versions if versioning is on.
See it in code
Walk through the code
1import uuid2import boto33from flask import Flask, jsonify, request4 5app = Flask(__name__)6s3 = boto3.client("s3", region_name="ap-south-1")7BUCKET = "acme-file-share"8 9@app.post("/upload-url")10def upload_url():11 user_id = request.headers["X-User-Id"] # from your real auth in production12 filename = request.json["filename"].replace("/", "_")13 key = f"uploads/{user_id}/{uuid.uuid4()}-{filename}"14 url = s3.generate_presigned_url(15 "put_object", Params={"Bucket": BUCKET, "Key": key}, ExpiresIn=300)16 return jsonify(url=url, key=key)17 18@app.get("/download-url/<path:key>")19def download_url(key):20 user_id = request.headers["X-User-Id"]21 if not key.startswith(f"uploads/{user_id}/"):22 return jsonify(error="not your file"), 40323 url = s3.generate_presigned_url(24 "get_object", Params={"Bucket": BUCKET, "Key": key}, ExpiresIn=300)25 return jsonify(url=url)1/4One S3 client and one bucket. Credentials come from the environment, never from code.
A tiny Flask backend. Run it with an IAM role (or SSO profile) that may only s3:PutObject and s3:GetObject under uploads/.
Save yourself the pain
Common mistakes
Oops
Streaming every upload through your Flask server.
Do this instead
Let the browser PUT directly to S3 with the presigned URL. Your server stays small and cheap.
Oops
Giving the backend role s3:* on the whole bucket.
Do this instead
Allow only PutObject and GetObject on arn:aws:s3:::acme-file-share/uploads/*.
Your mission
Build and harden it
Quick check
Why does the backend, not the browser, choose the S3 object key?
Go deeper
- 1Generate upload and download URLs from a small Python or Node.js backend.
- 2Keep Block Public Access on and prove direct object URLs return Access Denied.
- 3Add a lifecycle rule that deletes uploads after 30 days, and explain it in the README.
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.