Amazon EC2 permissions and a simple web server - amazon-ec2

I just started experiment with EC2 tonight, and got a server running locally. I know it works locally because when I curl http://localhost:8080/hello it outputs hello.
I want to access this from the outside world. I modified my permissions in my security group to allow 8080 access, and then typed in "curl http://ec2-123-45-67-891.compute-1.amazonaws.com:8080/hello" into my local terminal. I got the response "curl: (7) couldn't connect to host".
Do I need to do something differently? (Obviously yes, but what?)

Have you bound your server only to localhost? If so, you'll only be able to connect from localhost.
Check the netstat output for your process with something like:
sudo netstat -ltnp | grep your_server_process
Look for whether your server process is bound to 127.0.0.1:8080 or 0.0.0.0:8080. If the former, then you're only bound to localhost and you need to reconfigure it.

I met the same issue. Try use 0.0.0.0 instead of 127.0.0.1.

You allowed access on 8080, but in your localhost example, it's running on port 80.

Related

How can I access port 8001 with a proxy server even when it's not open?

So I did the following:
minikube dashboard
kubectl proxy
And it says Starting to serve on 127.0.0.1:8001, however this port is not open on my VM (not included in my firewall rules)
then how am I able to access it via ssh tunneling?
Basically I did this:
ssh -L 12345:localhost:8001 myLogin#myRemoteServer
And then accessed it as:
http://localhost:12345/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/pod?namespace=default
I find this helpful kubectl proxy --address='0.0.0.0' --disable-filter=true

Windows - jboss on docker, connection refused to local oracle database

I have Jboss running in a docker container. On jboss I have defined a connection to the xa-datasource database as the ip address of my computer and not localhost because I work in Windows 10. Despite the correct ip and port to the database (oracle) I keep getting the connection refused error. I run jboss with the command
docker run -d -p 8080:8080 -p 9990:9990 myjboss
Can anyone help me, or do I need any additional settings in my docker. I will add that I also test alpine and in the container (exec) I can ping my ip address.
Thanks a lot for all the answers. I would like to add that I tested all other solutions contained in similar questions, but unfortunately I did not get the expected results.
If you can ping your host IP, but you can’t connect to the database, granted that the DB is running and the listener is up...
I’d advise you to check the Windows Firewall settings.
Maybe try disabling it to check if you can actually connect to the database, if so, add an Inbound Rule to the firewall to allow connections on port 1521 (or whatever port your listener is running on)
I solved this problem by using not ip/localhost but host.docker.internal as described here -> https://docs.docker.com/docker-for-windows/networking/

OSX SSH tunnel from remote port to local

I've created SSH tunnels in the past, but I'm having trouble on OSX. I'm looking to take a website's port 80, and direct it to my localhost:8080. When I run this command
ssh -L 8080:<cloud_ip_address>:80 root#<cloud_ip_address> -N
I get the default apache 'it works!' page.
Why am I not getting the port 80 of the remote machine (which is running a web app)?
UPDATE
I still do not have a solution yet, but I have some more information. The page I am getting is the default page in /var/www/html but I am serving a Flask app which does not have static pages.
Because HTTP protocol contains not only the IP address, but also the hostname (the URL you type into your browser), which differs between the <cloud_hostname> and localhost. The easiest way to trick it is to create /etc/hosts (there will be some OSX alternative -- search ...) entry redirecting the hostname of your remote machine to localhost.
127.0.0.1 <cloud_hostname>
But note that in this case you will not be able to access the remote machine using the hostname!

Accessing remote server service via HTTPS

I have a server(AWS) to which I have ssh access.
There is a service(supervisor) running on this service on port 9001 whose web view can be accessed through 127.0.0.1:9001 had it been a local machine.
But since it is not a local machine, how do I access it?
I got the ip address of the machine using ifconfig | grep inet and then tried accessing it through https://172.11.11.1:9001/
Bit dint work.
When I tried wget https://172.11.11.1:9001/ it shows
Connecting to 172.31.19.8:9001... and hangs there.
I have added the following line in my supervisor conf file.
[inet_http_server]
port = *:9001
Can someone please help me with this?
This is more of a server config question. You'll most likely find your AWS access properties allow connections on post 22, 80 and 443 only. In AWS console you'll need to add a new security access group to allow port 9001 to be accessed.

Rserve fails to set up connection

Up to yesterday, I have been connecting Tableau with R through Rserve on my localhost. Today, when I try to make the connection again, Tableau complained:
a error occurred during connection to localhost: 6311. No connection could be made because the target machine actively refused it
I doubled check Rserve is running. However, when I typed telnet localhost 6311 in cmd, no connection can be detected. It strikes me that something worked well for a few months suddenly stopped to function. I did installed RMySQL yesterday which seem to coincide with the timing, but is it possible? Any idea how to trouble shoot? Thanks.
Multiple things might be happening here.
check your netstat -ntlp output and see if its' listening on port 6311 and check if it's listening at 0.0.0.0:6311 or 127.0.0.1:6311. If you use the hostname rather than localhost it should be able to connect as long as the deamon is up. To connect using localhost from the same machine, stop Rserve and restart it as R CMD Rserve this will bind it to the loopback address, if you want it remotely accessible then you'll have to restart it using R CMD Rserve --RS-enable-remote
If you are using linux, you'll need to check your firewall and see if port 6311 is allowed .... ufw allow 6311 will do the trick.
Ben
This explanation may be helpful.
In my case, I was running through 'Rserve' and the configuration did not allow remote.
Initially invoke the Rserve using the command R CMD Rserve --RS-enable-remote from your server.Then call Rserve from your client machine.To test the connection try telnet IP port to the server which runs Rserve.This will do the trick.

Resources