When you terminate an instance-store pv instance through the AWS console or the API, what "signal" does it receive so it knows it has to gracefully shut down?
First guess would be ACPI, but on boot Linux reports
ACPI in unprivileged domain disabled
ACPI: Interpreter disabled.
EC2 uses Xen. The Xen PV driver handles the shutdown. If you were using an HVM instance, ACPI would handle the shutdown.
The command that will be run can be seen by running:
sysctl kernel.poweroff_cmd
And can be changed by running (as root):
sysctl kernel.poweroff_cmd="/usr/bin/systemctl poweroff"
Which can be made permanent on a modern systemd based system by:
cat << EOF > /etc/sysctl.d/poweroff.conf kernel.poweroff_cmd = "/usr/bin/systemctl poweroff" EOF
@Mark Wagner explained it, but the
sysctl
aspect wasn't clear to me!