Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to work with facebooks real-time updates but I'm having trouble giving facebook a callback address that they can use. My dev machine is behind a firewall so I want to use an ec2 instance to forward traffic to the dev machine.

Progress so far:

  • App is up and running on localhost:

    http://0.0.0.0:5000
    
  • Created Ubuntu 10.11 instance on ec2

  • Authorize ports on ec2 instance

    localhost$ec2-authorize default -p 5000 
    localhost$ec2-authorize default -p 22
    
  • Configure sshd on ec2

    localhost$ssh -i ubuntu@ec2_public_dns -i ~/.ssh/ec2_key_pair.pem
    ec2$sudo echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
    ec2$sudo echo "GatewayPorts yes" >> /etc/ssh/sshd_config
    ec2$sudo /ect/init.d/ssh restart
    
  • Start ssh tunnel

    localhost$ssh -R0.0.0.0:5000:localhost:5000 ubuntu@ec2_public_dns -i ~/.ssh/ec2_key_pair.pem
    
  • Test it in the browser

    http://ec2_public_dns:5000
    

But nothing happens :( The request just times out. Any ideas what I'm doing wrong?

Thanks!

PROGRESS

OK, I'm making some progress hitting the web server on my local machine. After I ssh in, I can get the home page from the prompt using curl:

localhost$ssh -R0.0.0.0:5000:localhost:5000 ubuntu@ec2_public_dns -i ~/.ssh/ec2_key_pair.pem
ec2$curl localhost:5000
<!DOCTYPE html>
<html>
...
</html>

It even works with the ec2_public_dns from the ec2:

ec2$curl ec2-23-20-132-36.compute-1.amazonaws.com:5000

<!DOCTYPE html>
<html>
...
</html>

but, it can't connect from my local development machine:

localhost$curl ec2-23-20-132-36.compute-1.amazonaws.com:5000
curl: (7) couldn't connect to host
share|improve this question
    
OK, I figured out where I went wrong. When I created the ec2 instance, I chose "quick launch" because I figured I just needed a simple unix that had sshd running on it. The problem is, this creates a separate security group named "quicklaunch-1". So, This localhost$ec2-authorize default -p 5000 Should be this: localhost$ec2-authorize quicklaunch-1 -p 5000 Now, when I test from my local machine, I get the web page I was expecting: localhost$curl ec2_public_dns:5000 <html> ... </html> –  spinlock Mar 7 '12 at 21:12
    
serverfault is being gay and not letting me answer my own question. The comment above is hard to read because there's no formatting in comments. Oh well. If anyone wants karma, just copy my comment to an answer. I'll totally check that for you ;) –  spinlock Mar 7 '12 at 21:13
1  
Well constructed question (good detail and diagnosis). Stack Exchange does encourage you to answer your own question - but for users with less than 100 rep, requires at least an 8 hour wait (it might be longer for SF, but after some time you will be able to answer your question). –  cyberx86 Mar 7 '12 at 22:01
add comment

1 Answer

@spinlock: you never returned to claim your answer, but access rules struck me as the first possibility anyway. I definitely recommend anybody using EC2 spend a bit of time with the Security Groups stuff at first, it's powerful and really helpful. For sake of anyone googling, spinlock's answer is:

OK, I figured out where I went wrong. When I created the ec2 instance, I chose "quick launch" because I figured I just needed a simple unix that had sshd running on it. The problem is, this creates a separate security group named "quicklaunch-1".

So do this:

localhost$ ec2-authorize quicklaunch-1 -p 5000
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.