AWS - start automatically


I have a instance of node-red running on AWS.

Every time my EC2 gets rebooted Node-red stops, I have followed the instructions on Running on Amazon Web Services : Node-RED

   sudo npm install -g --unsafe-perm pm2
   pm2 start `which node-red` -- -v
   pm2 save
   pm2 startup

I re-run the above and it starts up.

Any suggestions as the why it does not start up on its own?

Kind Regards

Assuming you are using Ubuntu you can use the systemd script to run Node-RED as a service and it will start on boot without pm2

It's a Ubuntu instance.

Thanks, I have tried it, not starting up

sudo npm install -g pm2
pm2 start `which node-red` -- -v
pm2 save
pm2 startup

Pay attention to the last command, you will have to execute another command (like: sudo env PATH = $ PATH:/usr/bin/usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu)

You should use the install script on the page I linked to, this will install Node-RED, NodeJS and the systemd script that can be used.

As I said there is no need for PM2 with this method.


Personally, I prefer to use PM2, because it also ensures the node-red autorestart (if there is a crash).

I used the PM2, but it does not restart on a EC2 reboot.

I don't know the path you are referring to.

sudo systemctl enable nodered.service

Does not work ether.

PM2 do restart in EC2 reboot. Most likely you are missing something (or you have another problem).

I'm having the same issue as well. PM2 isn't restarting my node-red in an EC2 reboot.

The only solution were to delete the EC2 and recreate a new instance.

Is the problem PM2 not starting or node-red not restarting ?

The issue was node-red not restarting. I wound up deleting the EC2 and recreating and that did solve the issue.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.