Skip to content
Advertisement

how to set variable name for google cloud instance

PROB_INSTANCE_NAME=INSTANCE_NAME

not working

C:UsersHPAppDataLocalGoogleCloud SDK>PROB_INSTANCE_NAME=lamp-1-vm ‘PROB_INSTANCE_NAME’ is not recognized as an internal or external command, operable program or batch file.

C:UsersHPAppDataLocalGoogleCloud SDK>set PROB_INSTANCE_NAME=lamp-1-vm

C:UsersHPAppDataLocalGoogleCloud SDK>gcloud compute instances stop “$PROB_INSTANCE_NAME” ERROR: (gcloud.compute.instances.stop) HTTPError 400: Invalid value ‘$PROB_INSTANCE_NAME’. Values must match the following regular expression: ‘a-z?’

i am using google gcloud tool on the desktop.

trying to install Linux guest environment by cloning root disk.

Advertisement

Answer

I’m not sure if you are using Linux or Windows, Looking your commands looks like you are using Windows. If you are using Windows the correct commands are:

1) look if you are using the correct user and project

gcloud status

2) in case that you aren’t using the correct user account or project you can config these settings by executing.

gcloud init

3) set your instance as a variable

set PROB_INSTANCE_NAME=lamp-1-vm

4) exec the stop command by using the variable and the zone

gcloud compute instances stop %PROB_INSTANCE_NAME% --zone zone_of_your_instance
Advertisement