ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

tl;dr: Don't. Use a VPN instead.

Running a ROS master on a public IP isn't really a good idea, since anyone can discover it and poke around in your system. Someone at Defcon a few years back had a ROS robot on an open network and was inviting people to hack it, and I was able to inspect and take control of it in about 30 minutes.

Instead, I would recommend that you set up a VPC and connect remote clients to it over VPN. I haven't done this much but this guide looks like a good starting point: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpn-connections.html

EC2's network setup is a bit like being behind a NAT firewall, since the public IP isn't actually bound on the local machine. External nodes need to use one IP and on-machine nodes need to use the local IP, so when I've had to do this I used the machine's hostname in the ROS_MASTER_URI and ROS_HOSTNAME; and then make sure that the DNS record for the hostname resolves to the public IP, and then add an override for it in the EC2 instance's /etc/hosts that resolves to 127.0.0.1