I had a project where I need to run a command at EC2 reboot. I found only information about User Data but that works only at first launch which is not exactly what I needed. I need a command to run everytime I connect to the machine.
You can store a shell script in this directory:
/var/lib/cloud/scripts/per-boot/
It will be automatically run after every boot. (This is done by cloud-init, which also runs User Data scripts.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With