How to troubleshoot google cloud instance issue - google-cloud-platform

I have a google VM instance that stopped working sometime in the last 4 days. The last time I tried to access it, everything was fine. By 'stopped working' I mean:
Unable to connect to websites hosted at that instance
Unable to connect to the instance using gcloud compute ssh
I can connect to the instance by opening an ssh terminal in a browser window from within console.gcloud.google.com.
Running gcloud compute ssh from my local terminal results in:
ssh: connect to host 34.69.41.204 port 22: Operation timed out
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Connecting over http results in:
wget http://panam.whensparksfly.org
--2021-10-11 11:18:00-- http://panam.whensparksfly.org/
Resolving panam.whensparksfly.org (panam.whensparksfly.org)... 34.69.41.204
Connecting to panam.whensparksfly.org (panam.whensparksfly.org)|34.69.41.204|:80... failed: Operation timed out.
If I run that same wget command from the browser-based terminal I started from https://console.gcloud.google.com, it works.
I've tried stopping and restarting the instance. I also have another instance that I usually leave off. I started that instance and had the same problem.
Here are the firewall rules for that instance:
How should I go about troubleshooting this?

This is not an answer to my specific question about how to troubleshoot the problem, but here's how I resolved the issue:
Create a new machine image from the original instance
Create a new instance from the machine image. Go to the Machine Images page in the Google Cloud Console, click the Actions button for the desired image, then click create instance.
I was able to transfer my static external IP address to the new instance by following the instructions here.
Everything is now working as before.

Related

It won't let me connect to my instance's ssh

It won't let me connect to the instance's ssh it just keeps loading, I tried to delete it and create it again but nothing, still check the firewall and the ports are not causing an echo.
I had a similar issue with the web console built-in client. Clean browser cache, try a different browser, use gcloud compute ssh from cli or cloud shell. BTW, if it's an access issue (however you should have received an error in ssh window in this case) - you'll see same problem in command line, if it's a browser issue cli will work.

Creating Notebook Failed - An error ocurred while creating a new notebook GOOGLE CLOUD DATALAB

In GCP. According to this Article, https://mohameddhaoui.github.io/dataengineering/chatbot3/
I created a new google cloud datalab instance, and run it on port 8081. When I go to Google Cloud Datalab and click on add note, the following error is presented.
Datalab Error PrintScreen
I am the owner of the account and have full access to the resources.
This is the command I used to deploy the datalab instance:
datalab create datalab-instance
The result of the execution is as follows.
This will create an SSH tunnel and may prompt you to create an rsa key pair. To manage these keys, see https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys
Waiting for Datalab to be reachable at http://localhost:8081/
ssh: connect to host 35.229.109.170 port 22: Connection refused
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
Connection closed
Attempting to reconnect...
Waiting for Datalab to be reachable at http://localhost:8081/
Enter passphrase for key '/home/myuserXXX/.ssh/google_compute_engine':
The connection to Datalab is now open and will remain until this command is killed.
Click on the Web Preview (square button at top-right), select Change port > Port 8081, and start using Datalab.
Your help will be very appreciated.
Best Regards

GCP VM instance hosted Website showing connectino refused error message

I am trying to fix a website that is hosted on Google Cloud Platform using VM instance. The website is giving me a connection refused error message. I have checked that the firewall rules are set up and are provided to the VM instance.
The VM external IP is static and the same IP is present on both cloud DNS and GoDaddy.
I'm also unable to SSH into the instance.
The SSH screen is stuck here and is not loading any further
I have given the necessary permissions to the instance and the user (Compute Admin, Compute Instance Admin (v1)), but still no luck.
As the instance is created from a custom image, so later, I tried creating another instance with the same config and I was able to SSH from it. So, please find some screenshots attached below if those could be of any help
netstat -a
route -n
df -h
I am new to this so any help to fix the issue and get the website up and running would be highly appreciated.
If it worked at the second attempt (2nd Instance I mean), I suspect that the SSH service hasn't started properly. I would recommend you to check the Serial Port Output, and Accessing into the Instance through the serial port in order to be able to troubleshoot it.
Note that you'll need a user to access through the serial port. If you don't have any user created, you will be able to do so using an startup-script.
Hope this helps!

AWS Ec2 "Connection refused"

I used to be able to connect to my ec2 instance but suddenly I am no longer able to and I do not know why. My security group is the same, allowing ssh from anywhere. I have some information below regarding the errors that I am getting. Please can someone advise?
From FileZilla I am getting:
Error: ssh_init: nodename nor servname provided, or not known
Error: Could not connect to server
From the terminal I am just getting:
ssh: connect to host ec2-xx-xxx-xxx-xxx.eu-west-1.compute.amazonaws.com port 22: Connection refused
i have the same issue i did the following troubleshooting steps and it still gives the same
ssh: connect to host [my public DNS] port 22: Connection refused
i checked the key ".pem" file and its correct on the right directory
no code edits as it used to work fine last night and suddenly this error appeared
i went to the AWS console, selected the instance , and clicked on connect and copied the SSH command to make sure that no typos , and the command is correct
i tried with -v , still same issue.
tried to reboot the instance , no progress
stop then start the instance , no progress
tried to detach the volum and re attach the volum back , no progress
i changed the instance type from t2.micro to t2.small , no progress
checked the security group , port 22 is assigned to all IPs and no problem with the security group at all as it used to work fine
tried from different computers from different networks, same issue
created new instance , i can access the new one but cant ssh to the old one still
my best guess is that the ssh daemon is not enabled but how to access it if i cant ssh to the instance

SSH Connect to AWS EC2 failed after using lets-encrypt update my website

Yesterday, I updated my Django website (on AWS EC2) to HTTPS by using lets-encrypt. Everything works well. The website has HTTPS green icon as expected.
Today when I try to connect my instance by using SSH. The connection keep hunging. Finally, It give some message like "ssh: connect to host ec2-34-202-93-189.compute-1.amazonaws.com port 22: Resource temporarily unavailable".
I thought it might be security group problem of this instance. So I double checked my security group setting of this instance, the SSH, HTTP and HTTPS port are all open correctly. I created another instance to test if there is any problem on my local. The new instance connected successfully. Then I apply the new instance to the security group that I made for the previous instance and It connected. Then I apply the previous instance to the new security that I made for the new instance, the connection got frozen again. I also tried to connect with putty and it was not working as well.
Now I am really confused. My local machine is Windows subsystem of Linux. My EC2 instance is Ubuntu 16. I am using Nginx as web server. My ssh command is "ssh -i blog_project.pem ubuntu#ec2-34-202-93-189.compute-1.amazonaws.com".
Here is my security group setup for the instance.
This is the result I command "ssh -vvv -i blog_project.pem ubuntu#ec2-34-202-93-189.compute-1.amazonaws.com"
BTW, Is there any way that I can login to my instance without ssh connection? Is there anything like console or shell inside the AWS that I can touch with my instance?
Check if the instance exists on AWS, maybe a new one was created with different Public DNS (xxxx.compute-1.amazonaws.com) than the one you are using in your command.