After the script has successfully uploaded and launched an instance of the image, it loops until it detects console output before continuing (the checkForConsoleOutput function). I had an instance hang for 2 hours because there was no console output. It might make more sense to add a timer to this loop and terminate after a threshold time (15 minutes?) is passed.