Google Cloud Services - unable to SSH into instance at all
Google have developed a troubleshooting script for VM instances having problems with SSH connectivity. Here is the link: https://github.com/GoogleCloudPlatform/compute-ssh-diagnostic-sh
One of the reasons for receiving this error is that the firewall rules for the VPC are not configured to allow SSH ingress access to the instance. You can validate this configuration in the Google Cloud Console:
- Go to the project that your VM is active in
- Using the left side popout menu, select 'VPC network'
- Click on Firewall rules
- Check for a rule that allows SSH access via TCP on port 22 with a target that is inclusive of your instance or 'Applies to all'
- If the rule is missing, create the firewall rule, for the 'Source IP Ranges', enter the public IP address of your Internet connection or enter 0.0.0.0/0 to allow connections from anywhere on the Internet