Run EC2 user-data script as non-root user

I'm able to run a user-data script successfully, but it runs as root. I start up a few long running processes with this script, and would like them to be non-privileged processes. Is there some way to accomplish this, either with user-data scripts or some other method? I'm running an AMI based on Amazon Linux 2012.03.


Amazon Linux uses cloud-init to implement the ability to run scripts from user-data, a tool invented by alestic.com, and expanded by Ubuntu. It is currently supported by the Ubuntu distro (via the cloud-init package), and by the Amazon Linux distro.

I'm not aware of a built-in way to run as a different user, but since cloud-init supports shell-scripts you could just run a script that starts a process as another user. The standard unix tools are available for this, such as sudo or su.