Connection via Cloud Identity-Aware Proxy Failed
Solution 1:
If the allowed Ingress for tcp:22, included your source/s IP then there is no issue with the GCP firewall and my suggestion is to do the following steps and established a serial connection to your VM and after that will be able to check the SSH service is up and in the listening mode or even check for any firewall blocking inside your VM.
- Go to the VM instances page in Google Cloud Platform console.
- Click on the instance for which you want to add a startup script.
- Click the Edit button at the top of the page.
- Click on 'Enable connecting to serial ports'
- Under Custom metadata, click Add item.
- Set 'Key' to 'startup-script' and set 'Value' to this script:
#! /bin/bash
useradd -G sudo USERNAME
echo 'USERNAME:PASSWORD' | chpasswd
NOTE: Change the value of USERNAME & PASSWORD to the username and password of your choice.
- Click Save and then click RESET on the top of the page. You might need to wait for some time for the instance to reboot.
- Click on 'Connect to serial port' in the page.
- In the new window, you might need to wait a bit and press on Enter of your keyboard once; then, you should see the login prompt.
- Login using the USERNAME and PASSWORD you provided.