'How is GCP letting me SSH to internal IP via GCP Console
I have a VM with internal IP only, no external IP. But I can SSH into it via GCP console by clicking the SSH button next to the VM name. How is this possible?
Solution 1:[1]
There are 3 way to connect to instances that do not have external IP addresses in GCP, as described here
- Connect to instances over a VPN connection
- Connect through a bastion host instance
- Connect using Cloud Identity-Aware Proxy for TCP forwarding
Solution 2:[2]
You are not accessing the compute through the internet, google is accessing the compute internally and is giving you access to the console.
That's how you can still access it even with only internal ip.
Solution 3:[3]
Probably a bit late, but still:
Google console is launching a VM for you and you have access through your web browser. Said VM is inside Google internal network and can SSH using the internal ip of your instance that is not expose to the external world.
If you want to ssh into a GCE instance that does NOT have an external IP from your computer, you can ssh using gcloud SDK (you need to set it up first):
gcloud compute ssh --tunnel-through-iap $INSTANCE_NAME --zone $ZONE --project $PROJECT_NAME
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DragosO |
| Solution 2 | night-gold |
| Solution 3 | TanisDLJ |
