Skip to content

Add S3 Express cache layer examples with spawn workers#36

Open
ksmotiv8 wants to merge 1 commit intomainfrom
feat/s3-express-cache-sample
Open

Add S3 Express cache layer examples with spawn workers#36
ksmotiv8 wants to merge 1 commit intomainfrom
feat/s3-express-cache-sample

Conversation

@ksmotiv8
Copy link
Contributor

Summary

Adds three new examples demonstrating a write-through cache pattern with async durability using S3 Express One Zone:

  • s3-express-upload.rs: Upload function that writes to Momento Cache synchronously and spawns an async worker for S3 durability
  • s3-express-worker.rs: Spawn function that handles async S3 uploads with full AWS SigV4 signing and metrics logging to topics
  • s3-express-download.rs: Cache-first download with S3 fallback

Key features demonstrated

  • AWS SigV4 signing from scratch for S3 Express (service name: s3express, not s3)
  • spawn!() vs post!() macros for spawn vs web functions
  • Logging metrics to Momento Topics for observability of async workers
  • Runtime environment variables via -E flag at deploy time
  • Server-side timing instrumentation

Architecture

Client Request
      |
Upload Function
   |         |
Cache     spawn()
(sync)       |
         Worker
            |
       S3 Express
        (async)

No credentials included

All AWS credentials are read from environment variables at runtime using std::env::var().

Test plan

  • Verify examples compile: cargo build --examples
  • Review code for any hardcoded credentials
  • Test deployment with actual AWS credentials via -E flags

Generated with Claude Code

Three new examples demonstrating a write-through cache pattern with async
durability using S3 Express One Zone:

- s3-express-upload.rs: Upload function that writes to Momento Cache
  synchronously and spawns an async worker for S3 durability
- s3-express-worker.rs: Spawn function that handles async S3 uploads
  with full AWS SigV4 signing and metrics logging to topics
- s3-express-download.rs: Cache-first download with S3 fallback

Key features demonstrated:
- AWS SigV4 signing from scratch for S3 Express (service name: s3express)
- spawn!() vs post!() macros for spawn vs web functions
- Logging metrics to Momento Topics for observability
- Runtime environment variables via -E flag at deploy time
- Server-side timing instrumentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant