Events, Versioning & Lifecycle Rules

Make S3 do work for you: trigger code on upload, undo mistakes, and cut costs automatically.

1 min read

Event notifications: S3 as a trigger

S3 can notify other services the moment something changes, for example "a new object was created under notes/". This is the heart of event-driven design. Nothing polls and nothing sits idle waiting.

In NoteSnap, an upload triggers a Lambda function that reads the note and asks Bedrock for a summary.

Versioning: an undo button

With versioning on, overwriting or deleting an object keeps the old version. If a buggy script wipes customers.csv, you restore yesterday's version in seconds.

Tip

Turn on versioning for any bucket holding data you'd be sad to lose. Pair it with a lifecycle rule that expires old versions after, say, 30 days so storage doesn't grow forever.

Lifecycle rules: automatic housekeeping

Rules like these run for you, every day:

  • Move objects under logs/ to Glacier after 90 days.
  • Delete objects under tmp/ after 7 days.
  • Delete non-current versions after 30 days.
How it flows
  1. 1User uploads note

    PutObject to S3

  2. 2S3 event fires

    ObjectCreated

  3. 3Lambda runs

    Reads the new note

  4. 4Result saved

    Summary stored

Key takeaways

  • S3 events let uploads trigger code automatically, so you never need to poll.
  • Versioning protects against accidental overwrites and deletes.
  • Lifecycle rules move or delete data on a schedule to control cost.

Check your understanding

Pick an answer to see the explanation.

  1. 1. A script accidentally overwrote an important file. Which S3 feature lets you recover it?