0

I have a server listening on http://0.0.0.0:8000, however this is living in an Amazon instance.

How can I make an HTTP POST request from an external computer (using curl)? That is, I would like to use the server listening as an API. This is different from other cases because I would like to do it over ssh.

anon
  • 101

1 Answers1

0

If you want to run curl on the EC2 instance, and tunnel the output via ssh, then try the following:

ssh ${USERNAME}@${EC2_INSTANCE_IP} curl -s http://localhost:8000/

You should see the result directly on the terminal (-s will inhibit curl's output).

You can run any command like this, there's nothing special for curl.

If this works, then you can alter the curl parameters to use -X POST and/or -d, along with the correct endpoint.


Please remember though, that 0.0.0.0 is a "special" address that actually means "listening on all interfaces"... So unless you configure the inbound rules correctly, anyone can still do curl http://${EC2_INSTANCE_IP}:8000/ and hit your server.

Attie
  • 20,734