Running a script via AWS userdata and cloud-init

I’m trying to start up an ec2 instance with userdata that should configure some stuff and launch a rancher/server container. The script I have is based off of this one: https://github.com/greensheep/terraform-aws-rancher-server/blob/master/files/userdata.template (tailored to be a bit more specific for rancherOS).

The instance starts up but is unreachable… it seems that there is some error that is blocking ssh from starting. It has been roughly 12 hours since I started up the instance and it is still in the same state, so I know that I’m not just being impatient.

The documentation indicates this script should run -

If the file starts with #! (e.g., #!/bin/sh), cloud-init will simply execute that file. You can place any configuration commands in the file as scripts.

Is there something obvious I am doing wrong?

Even a simpler script that just has

#!/bin/bash
sudo docker run -d --restart=always -p 8080:8080 rancher/server

in it does not run properly.

Just in case anyone else stumbles on this, here is some more information about this issue: https://github.com/rancher/os/issues/1106