Search code examples
amazon-web-servicesamazon-ec2cloud-init

Use EC2 cloud-init startup script to launch a long-running task


I use my cloud-init startup script when my EC2 instance starts to install packages, pull code and then launch a long-running task, which may run for days:

su - username -c 'python /path/script.py'

Is this an issue for cloud-init if the script stays stuck for days at this line? And if so what is the best way to let the script run while permitting the cloud-init script to end?


Solution

  • It turns out it was not an issue to have a cloud-init script running for hours. AWS does not seem to have a mechanism in place to kill cloud-init scripts that have not terminated after a few hours.