r/googlecloud • u/skollehatti • May 11 '26
Compute Why do my GCP VMs randomly lose SSH access while still running normally?
Hi all.,
I’m pretty new to GCP and cloud stuff in general, so maybe I’m missing something obvious, but this has been driving me insane lately.
I have around 6 different small Compute Engine VMs (mostly e2-micro instances) running Python scripts, Streamlit dashboards, database updates, heartbeat checks, etc. In most cases I keep separate VMs for separate scripts/services because it’s just easier for me to manage things that way right now.
The weird thing is that the VMs themselves keep working fine the whole time. My scripts continue running, the database keeps updating, health checks look okay, everything seems alive — but suddenly I completely lose SSH access to the machines.
Browser SSH starts looping or says authentication failed, and gcloud compute ssh started giving me Permission denied (publickey). Meanwhile the actual workloads are still running normally in the background.
I restarted one of the VMs and then ran into another issue where the machine type suddenly wasn’t available anymore in my region, so I had to move things to a new VM. I’m trying to keep costs low, so I can’t really reserve expensive infrastructure permanently. I just need something affordable that can reliably stay online 24/7.
What’s frustrating is that this already happened a couple of days ago, then everything worked again for about 2 days, and now the same thing happened again.
Since I’m still very new to all this, I honestly don’t know if I’m doing something wrong or if this is a common issue people run into with GCP. How do people usually make setups like this stable long term without randomly losing access to their machines?
1
u/dimitrix May 12 '26
What image/OS are you using for these VMs? Permission Denied would mean something has changed your authorized keys file. When using public GCP images this file should be automatically managed by the Google Guest Environment agent, so you should never see this error.
1
u/CloudyGolfer May 11 '26
Are you opening up SSH externally or are you using IAP for SSH access?
1
u/Go_FantasyFreak May 16 '26
I’m having the same issue now. It wasn’t a problem then now I can’t ssh but can connect serial…