Amazon EBS TRIM: snapshot size before and after fstrim One volume, two snapshots: the only change between them is TRIM switched on and fstrim run. AWS Cloud Region us-east-1 VPC, no internet route Private subnet Presenter quickstart.py AWS Systems Manager Run Command Interface endpoints ssm, ssmmessages, ec2messages t4g.nano instance IMDSv2, no public IP writes, deletes, fstrim 8 GiB gp3 volume encrypted TrimOnAttach Snapshots A and B A before TRIM B after fstrim EBS direct APIs ListSnapshotBlocks Amazon EC2 API ModifyVolume 1 2 3 4 5 6 1 2 3 4 5 6 LINES Run Command, private path Block data Volume API calls Count snapshot blocks FLOW The script sends shell commands with Run Command. No SSH, no inbound rule. The instance writes 2 GiB to the volume, deletes it and tries fstrim: refused. Snapshot A is taken with TRIM off, then snapshot B after step 5. ModifyVolume sets TrimOnAttach to enabled; the script detaches and reattaches. The instance runs fstrim, which now sends TRIM for the free blocks. ListSnapshotBlocks counts the 512 KiB blocks each snapshot holds.