Serverless · Freelance

Presigned-Upload Document Parsing API

SAM stack where a client requests a presigned S3 URL, uploads a PDF directly, and an S3-triggered Lambda parses it and stores computed results.

  • API Gateway
  • Lambda
  • S3 presigned URLs
  • DynamoDB
  • Lambda layers
  • SAM
  • Make

// Overview

Three Lambdas sit behind API Gateway with CORS. One generates a document ID, writes metadata and returns a presigned PUT URL; one is triggered by the S3 event, parses the PDF into a typed model and runs a calculator; one returns results by ID. A layer holds dependencies and a Makefile packages and deploys.

// The problem

Users needed to upload statements and get structured, computed results back without the file passing through the API tier.

// Flow

Presigned-Upload Document Parsing API flow1. POST upload → 2. Direct upload → 3. S3 event → 4. Parse → 5. Calculate → 6. Store → 7. GET results01POST upload02Direct upload03S3 event04Parse05Calculate06Store07 · GATEGET results
  1. POST uploadcreate an ID, save metadata, return a presigned URL
  2. Direct uploadclient PUTs the file straight to S3
  3. S3 eventobject-created invokes the parse Lambda
  4. Parseline parsers map text to a typed model
  5. Calculatehelpers produce results
  6. Storeresults written to the record
  7. GET results gateresults returned by ID

// Design decisions & guardrails

  • Presigned upload avoids API payload limits and keeps files off the Lambda path.
  • Asynchronous, ID-keyed results pattern.
  • A layer for heavy dependencies; make-based reproducible deploys.

// Outcome

Scalable document intake with no servers.

// Related