Starting a long-running process in cloud-init on ec2 instance

The reason the process was not running was that the Amazon EC2 Linux instance is Red-Hat like, and there is a bug/feature in those distros that a sudo command requires a tty. There is no tty attached to the environment when the cloud-init is processed, and so it fails.

One answer is to edit etc/sudoers and change the line

Defaults requiretty

to

Defaults !requiretty

There are other approaches, apparently, but this worked for me.