An S3 presigned URL is, in my view, one of the most underrated features in AWS. As soon as an application accepts files, whether photos, PDFs or exports, the same question comes up: do I push the file through my Lambda function or straight into the bucket? Many teams start with the first option because it feels familiar. By the first 8 MB phone photo at the latest, you run into hard limits.
In this article you build an upload where the Lambda function only issues a short-lived permission and the browser sends the file to S3 itself. The example is a fictional bike rental: when returning a bike, customers photograph scratches or a flat tyre and upload the pictures. You get the complete code with the Serverless Framework, tests with Vitest and the pitfalls I trip over most often with this pattern.
In short
With an S3 presigned URL, the browser uploads files directly into a private bucket while your Lambda function only decides target, file type, size and expiry.…