Compute and storageeasy0-2 years

An EC2 instance type comes with a fast local NVMe disk. A teammate proposes putting a self-managed PostgreSQL data directory on it 'for speed', and after a planned stop/start of the instance for a resize, a Redis cache on the same kind of disk comes back empty. Explain what happened, and which workload belongs on which kind of storage.

That local disk is instance store: physical storage on the host machine the instance happens to run on. Stopping an instance releases that host, so the data on the instance store is gone; a host hardware failure loses it too. EBS is network-attached storage on AWS's own storage servers: it persists independently of the instance, survives a stop, a termination (if configured to) or the host failing, can be detached and reattached, and can be snapshotted. The cache coming back empty is instance store doing what it is designed to do. The rule: a database's data directory goes on EBS; a cache nothing depends on, a scratch disk or temp space can use instance store, because losing it costs only a warm-up.

The lesson behind it →
More on Compute and storage