Skip to content

Instantly share code, notes, and snippets.

@swaroopch
Created November 8, 2012 07:03
Show Gist options
  • Save swaroopch/4037328 to your computer and use it in GitHub Desktop.
Save swaroopch/4037328 to your computer and use it in GitHub Desktop.
(not working) How to expose a local server to the outside world via an EC2 server?
# Before: I have a local Java or Django server running on port 8000
function expose_port {
local_port=$1
shift
ssh -vvv -i "$HOME/.ssh/aws.pem" -N -R "9000:localhost:8000" "ubuntu@ec2-12-34-56-789.compute-1.amazonaws.com"
}
# After: Open http://ec2-12-34-56-789.compute-1.amazonaws.com:9000 and it should work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment