passdrill
AWS SAA-C03 · EC2 & Compute · Card 023/024 easy

An engineer adds a shell script as user data to an already-running Linux EC2 instance's configuration, expecting it to reinstall a monitoring agent every time the instance reboots. After the script runs successfully at initial launch, the engineer reboots the instance and finds the script did not run again. Why?

  1. User data scripts can only ever run once per instance for the lifetime of that instance, with no way to change this
  2. The script failed silently the second time, because reboots automatically clear all instance user data
  3. By default, user data scripts and cloud-init directives run only during the first boot cycle at launch, not on subsequent reboots or starts, unless explicitly configured to run every time
  4. Reboots never re-read user data at all; only a full stop and start re-reads it
Next card → Shuffle