Skill 1.1.2

Design stateless applications that use externalized state management (for example, by using Amazon DynamoDB, Amazon S3, Amazon ElastiCache).

Key Concepts

State moves to a shared store chosen by its access pattern. Amazon ElastiCache (Valkey, Redis OSS or Memcached) holds sessions and short-lived data with sub-millisecond reads. Amazon DynamoDB holds durable session, cart or workflow state with TTL to expire old items and conditional writes to prevent lost updates. Amazon S3 holds files, uploads and large objects, which are referenced by key from the other stores.

Sticky sessions on a load balancer are a workaround, not a design: they unbalance load and lose sessions when an instance fails. Removing them requires externalising the session first. Local disks should hold only caches that can be rebuilt; anything else belongs in EFS, S3 or a database.