I am new to cloud-init, my final goal is to run an R script each time an EC2 Spot Instance becomes active, but in order to test it I created an on-demand Ubuntu 12.04 instance and created a simple script but nothing happens after reboot. Here are the steps I took:
- Launched the new Ubunut 12.04 instance
- Navigate to
/var/lib/cloud/scripts/per-boot
sudo vi script.sh
- Added the following code:
#!/bin/sh
echo "test"
sudo reboot
At this point I thought I should see a "test" print when the instance reboots, but there is nothing there. I went to take a look at /var/log/cloud-init.log
but there is no error or anything out of the ordinary.
I am clearly missing something so any tip in the right direction will be much appreciated!
Thanks!
rc.local
, this doesn't answer my original question as I still don't know why the script was not loading, but it might help someone in the same situation as mine – JordanBelf