AWS EC2 Instance keeps disconnecting - amazon-web-services

Currently, I'm using a Visual Studio Code SSH Plugin to edit my files directly on the EC2 without having to edit it locally and transfer the files. But I've noticed that the EC2 instance has stopped responding after 30 minutes or so and I have to keep rebooting the server in order for it to respond again. The problem is not with the plugin (in terms of connecting to the server) when VSC notifies me saying that the connection as dropped, the same thing occurred to all of my other SSH tools. Is there something I have to do in order for its connection to stay alive?
VSC Plugin: https://code.visualstudio.com/docs/remote/ssh
Error:
[16:07:19.876] stderr> ssh: connect to host ec2Host port 22: Operation timed out
[16:07:19.877] > local-server> ssh child died, shutting down
[16:07:19.879] Local server exit: 0
[16:07:19.880] Received install output: OpenSSH_8.1p1, LibreSSL 2.7.3
ssh: connect to host ec2Host port 22: Operation timed out

Related

How to Access Remote PostgreSQL Database Server Through VPN

I'm currently working with my office server, when i want to connect to the server, i have to use their VPN. I have installed PostgreSQL database in their server and have succesfully migrate data to database from Django project. But, when i want to remote access from HeidiSQL, it always gives me Connection Timed Out Error eventhough i have already connected to their VPN.
I've tried to this code below
/var/lib/pgsql/14/data/pg_hba.conf
host all all 0.0.0.0/0 md5
host all all ::/0 md5
/var/lib/pgsql/14/data/postgresql.conf
listen_addresses = '*'
i have tried to refresh everytime i change files and see if i'm in the correct port but it still gives me Connection Timed Out Error
this is the full error message
could not connect to server: Connection Timed out (0x0000274C/10060). Is the server running on host "xxx.xxx.xxx.xxx" and accepting TCP/IP connections on port 5432 ?
NOTES
OS : CentOS 8
DB : PostgreSQL 14

Connecting to Tensorboard Logs on a Remote Server: The Connection was Reset

When trying to connect to tensorboard logs on a remote server and entering the address http://localhost:16006/ in chrome and firefox I get this message in the command line "channel 3: open failed: connect failed: Connection refused" multiple times and this message on the browser, "The Connection was Reset".
I ssh into the server like this: ssh -L 16006:127.0.0.1:6006 username#machine and then go one level up the log folder and write: tensorboard --logdir logs --port 16006
I tired:
tensorboard --logdir logs --port 16006 --bind-all
and also
tensorboard --logdir logs --host localhost, also
tensorboard --logdir logs --host 127.0.0.1
None of the above has wroked. I tried running the line above from another environment which didn't help. I went to the office and tried connecting to the logs from the server machine directly and it worked.
It used to work before when accessing remotely. Do you know what the problem is? any hint would be immensely appreciated.
I am having the same problem, but I think you should designate --port 6006 since it looks like you are forwarding remote port 6006 to the local port 16006.
Even so, since 6006 is the default port, the other commands should have worked, but you would have to go to http://127.0.0.1:16006 on your local machine, rather than the link it provides.
Some more in depth explanations can be found here how to run tensorboard on a remote server and how to see tensorboard over ssh
Even following this advice though I am still getting a 'channel 3: open failed: connect failed: Connection failed' error

AWS Ubuntu SSH suddenly disconnects and can't reconnect

I created a new micro instance of Ubuntu Server 20.04 and connected with putty successfully. I did some work on the server, setting up nginx and other things. Out of the blue, my connection got disconnected and then when I try to reconnect using putty, I get a connection timeout. I spent a while trying to figure out what was wrong and gave up, so I created a new instance and did some work, and after about an hour, the same thing happened, disconnected and can't reconnect with a timeout error. What could cause this? How do I even troubleshoot?
So in the instructions for configuring NGINX on Ubuntu it gives instructions for configuring UFW, and says I needed to allow HTTP and HTTPS but made no mention of SSH, so I allowed SSH "ufw allow ssh" and then set ENABLED=yes in /etc/ufw/ufw.conf, and so far so good.

Unable to connect to the server connecteX Error

I am using Microk8s on my local Windows 10 machine and am unable to get pods or use most of kubectl commands.
At the time of installation of microk8s, multipass selected VitrualBox for VM virtualization.
I get below error
C:\Users\owner>microk8s kubectl get pods
Unable to connect to the server: dial tcp 10.0.2.15:16443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
VirtualBox Version 6.1
Ensured that multipass list shows that the VM is in running state.
There was a prior version of VitrualBox and minikube - both of which I have now un-installed and installed VirtualBox alone. Also cleaned up %USER_HOME%/.kube directory and %USER_HOME%/AppData/local/minikube & %USER_HOME%/AppData/local/VirtualBox folders too.

Error: connect ECONNREFUSED 127.0.0.1:3306 when using cloud sql for MYSQL from NodeJS app

I followed all the steps mentioned in this sample app link. GitHubLink. When running the script (npm run init-cloudsql) to initialize mysql database, I get an error below:
D:\gcloud\nodejs-getting-started\2-structured-data\books\model-cloudsql.js:143
throw err;
^
Error: connect ECONNREFUSED 127.0.0.1:3306
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
--------------------
at Protocol._enqueue (D:\gcloud\nodejs-getting-started\2-structured- data\node_modules\mysql\lib\protocol\Protocol.js:145:48)
at Protocol.handshake (D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\mysql\lib\protocol\Protocol.js:52:23)
at Connection.connect (D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\mysql\lib\Connection.js:130:18)
at Connection._implyConnect (D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\mysql\lib\Connection.js:461:10)
at Connection.query (D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\mysql\lib\Connection.js:206:8)
at createSchema (D:\gcloud\nodejs-getting-started\2-structured-data\books\model-cloudsql.js:126:14)
at prompt.get (D:\gcloud\nodejs-getting-started\2-structured-data\books\model-cloudsql.js:117:5)
at D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\prompt\lib\prompt.js:336:32
at D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\utile\node_modules\async\lib\async.js:154:25
at assembler (D:\gcloud\nodejs-getting-started\2-structured-data\node_modules\prompt\lib\prompt.js:333:9)
What am i missing? I could not resolve this error. Can someone help me fix this issue?
This error occurs when you run an instance of PopSQL or Node.js and the MySQL server is not running on your local machine.
Try the below steps
Press Windows key and R on your keyboard. This opens the command prompt
Type in services.msc and click ok.
In the services pop up , check for MYSQL57. If its not in the running state, Click on run this service in the left column of the dialog box
Once the service is running connect to the POPSQL from the connections window
The error message you shared indicates your machine could not connect to the instance's IP address on port 3307 (which is used by the proxy). I tested this on my own machine, and it is listening there. This likely indicates a firewall on your machine or your local network that is preventing outbound connections on port 3307. Try and open this in the firewall, and see if you can connect.
You need to whitelist your IP to access Cloud SQL. https://cloud.google.com/sql/docs/mysql/instance-access-control