Search code examples
amazon-web-servicesubuntuuser-data

Amazon AWS user-data not executing on Ubuntu 14.04 AMI


The following user-data is not running on a Ubuntu 14.04 AMI that has cloud-init package:

#!/bin/bash
screen -t "test" pwd

After the instance has initialized, screen -r prints There is no screen to be resumed. Is the user-data created incorrectly?


Solution

  • I believe screen has to be attached to a terminal to run. Scripts run by cloud-init aren't attached to a terminal.

    If you want to be sure your user-data script is being run, put something like echo Running > /tmp/checkit as the first line (following #!/bin/bash) so you can see if it creates the file.