How should my local server communicate with an EC2 server?
Problem
I have a node.js server running on ec2. I'd like for that server to automatically push data to another node.js server that is running on my laptop.
What is the best way to do something like this?
Solution
You could use a service like showoff.io to create an entry point to access your local laptop, or you could just create an SSH tunnel by running this command on your laptop:
ssh -R port:localhost:remoteport ec2-host
That will allow port
on the loopback interface of your EC2 server to connect to remoteport
on your laptop.
Then just modify your code to connect to the node.js program running on your laptop via the IP of 127.0.0.1
and port of port
.
Discussion
View additional discussion.