12
votes

I'm using Windows Server 2008.

on issuing gcloud compute ssh instance-1 --zone us-central1-a I receive the error:

ERROR: (gcloud.compute.ssh) Could not fetch instance:
 - Invalid value 'EFOnline'. Values must match the following regular expression: '(?:(?:[-a-z0-9]{1,63}\.)*(?:[a-z](?:[-
a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))'

To be clear, I did do a gcloud auth login and received a successful 'you are now authenticated' My project Name is EFOnline my instance name is : instance-1 us-central1-a (cut and paste there)

So why the weird regex error?? Thanks

3
try issuing the following command: gcloud config set project efonline. After doing so, try to ssh using the command posted in your project. Btw , no capital letters are accepted in the commands.George

3 Answers

18
votes

Google Cloud projects have both a name and an id.

Your project ID is the string that uniquely identifies your project to Google. Project IDs show up in URI paths to cloud resources, and have to be "good" strings to put in URIs. You can find the project id for your project at the "Overview" in http://console.developers.google.com/ page.

The project name is a human-readable string that can, for example, contain spaces and some special characters.

GCloud (and most of the GCP tooling) uses project ID.

So... please try the following: Look up your project id here: http://console.developers.google.com/ then run

$ gcloud config set project <id>
$ gcloud compute ssh instance-1 --zone us-central1-a

Also, we're working on fixing the error message.

13
votes

Also, if you have more google cloud accounts or you are not logged in, you need first to authenticate with google cloud:

gcloud auth login

after that, copy given link, login with wanted account and you will be able to SSH to google cloud console with gcloud command.

2
votes

Additionally, one can log into their developer console, open up your VM instance and click on the SSH widget at the top of the page, selecting View Gcloud Command. This will generate your specific string for terminal.

gcloud compute --project "project_name" ssh --zone "us-central1-a" "vm_instance_name"