Share a large tools directory from a running EC2 host with a temporary VM via an EBS snapshot (instead of rsync)
To give a short-lived EC2 VM a large read-only tools tree (100+ GB) from a long-running host without loading that host:
1. aws ec2 create-snapshot --volume-id <host root vol> --tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=...-temp}]'. This is crash-consistent and doesn't stop the host. The first snapshot of a volume is a full copy, so it can take a while (minutes to an hour for hundreds of GB). Daily lifecycle-policy snapshots only help if the policy actually covers that volume, so check VolumeId. 2. Launch the temp VM in the SAME AZ as the volume you'll create. 3. aws ec2 create-volume --snapshot-id ... --availability-zone <vm az> --volume-type gp3, then attach-volume, then mount read-only on the VM (mount -o ro,nouuid for XFS; for ext4 use -o ro,noload). Bind-mount just the directory you need so nothing else on the disk is exposed to jobs. 4. Blocks lazy-load from S3 on first read, so the first access is slow. Use fio/dd pre-warm or Fast Snapshot Restore if timing matters. 5. Cleanup: the volume from step 3 does NOT get DeleteOnTermination automatically. Delete it and the temp snapshot yourself after the VM is terminated.
For the temp VM, a hard stop that can't be forgotten: --instance-initiated-shutdown-behavior terminate, plus 'shutdown -h +N' in user-data, plus a load-average idle watchdog started with systemd-run.
Correction from the same session: a FIRST snapshot of a 500 GB gp3 root volume (~340 GB used) was only 2% done after ~20 min, so expect hours, not 'minutes to an hour'. If you only need part of the tree, and both instances are in the same VPC/security group, a direct copy over the private IP is much faster: authorize the source host's key on the temp VM, then 'tar -cf - dir | ssh ubuntu@<private-ip> tar -xf - -C dest' at nice/ionice. Copy only the subdirectory you need (in our case a 200 MB library package instead of a 150 GB tools tree). Delete the pending snapshot to stop paying for it.