LESSON 02 · Durable ingestion

Accept an upload safely

Let the API authorize an upload while object storage receives the large bytes directly.

SYSTEM VIEW

The video path

Diagram view
Parts stored—
Resent—
Video status—

Follow a 2 GB upload from permission to verified original, through a connection that drops after part 150.

  1. The Creator asks the Upload API to create an upload for a 2 GB source. Authentication, quota and size checks pass, so the API writes video 81 to the Metadata DB as a pending record.

    Checks
    auth, quota, size
    Source
    2 GB

    What changed

    • POST /uploads · 2 GB
    • Video 81, pending
  2. The Upload API answers with a presigned URL: short-lived permission to write one object key, v81/source.mp4. It records the owner and the expected key, so a guessed key can’t publish someone else’s upload.

    Key
    v81/source.mp4
    Scope
    one key, short-lived

    What changed

    • Presigned URL for v81/source.mp4
    • Owner and expected key recorded
  3. The Creator sends the 2 GB source straight to Video storage in 10 MB parts, 200 in all, each with a checksum. No video bytes pass through the Upload API, so big files don’t tie up its servers. 150 parts are in so far.

    Source
    2 GB
    Parts
    200 × 10 MB

    What changed

    • 150 of 200 parts stored
    • Bytes bypass the Upload API
  4. The connection dies while part 151 is in flight. Video storage keeps the 150 parts it already has, 1.5 GB. Sent as one request, the upload would have lost everything and started again from zero.

    Stored
    150 of 200 parts
    Kept
    1.5 GB

    What changed

    • Part 151 lost in flight
    • 150 parts, 1.5 GB, kept
  5. The Creator reconnects to the same upload session and resends parts 151 to 200: 50 parts, or 500 MB, rather than the whole 2 GB. S3 multipart uploads and the open tus protocol work this way.

    Resent
    50 parts, 500 MB
    Not
    the whole 2 GB

    What changed

    • Parts 151–200
    • 500 MB resent, not 2 GB
  6. Storage confirms the complete object, and the Upload API checks its size, checksum and media type before setting video 81 to uploaded. Retrying the same session avoids a duplicate. Uploaded means the original is durable, not that it can play.

    Checked
    size, checksum, type
    Uploaded
    durable, not playable

    What changed

    • Size, checksum and type verified
    • v81 pending → uploaded
  7. A lifecycle rule aborts abandoned sessions, since S3 keeps billing for an unfinished upload’s parts until they are aborted. Resumable flows also add client code and session state, so a 5 MB profile clip goes as one plain PUT.

    Stale parts
    aborted by a rule
    5 MB clip
    one plain PUT

    What changed

    • Abandoned parts aborted by a rule
    • 5 MB clip in one PUT

Space plays · ← → step · Home resets

THE IDEA

How it works

The client asks the API to create an upload. After authentication, quota, and size checks, the API creates a pending video record and issues a short-lived permission scoped to one object key, such as an Amazon S3 presigned URL. The client sends the file directly to object storage, so large bytes never tie up API servers. The API records the owner and expected object so a guessed key cannot publish someone else’s upload.

For unstable networks, use multipart or resumable uploads, which send a file as separately retried pieces, with checksums (short fingerprints that reveal corrupted bytes) and a completion step. Take a 2 GB source in 10 MB parts: 200 parts. If the connection dies after part 150, the client resends the last 50, or 500 MB, rather than 2 GB. S3 offers multipart uploads, and tus is an open protocol for the same job.

Parts are byte ranges; they need not match codec Groups of Pictures, the runs of frames that begin with one decodable on its own. When storage confirms a complete object, verify size, checksum, and media type before processing. Retry the same upload session to avoid duplicates. A “received” response means the original is durable, not that playback is ready.

Expire abandoned sessions and parts, since S3 keeps billing for parts of an unfinished upload until they are aborted, which a lifecycle rule can do automatically. Resumable flows also add client code and session state. A 5 MB profile clip is better served by one plain PUT.

DECISION POINT

A 900 MB upload stops at 85%. How can the creator continue without sending the first 85% again?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • Authorize a narrow direct upload, then verify the stored object.
  • Keep upload completion distinct from playable publication.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 3
ApplyQUESTION 01

A 40 GB camera file must be uploaded while API servers stay focused on control requests. How should the client send it?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 3 checkpoints answered correctly to complete this lesson.