Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Virtual compute instance in terminal problem

This is the code:
gcloud compute instances create gcelab2 --machine-type e2-medium --zone=$ZONE
ERROR: (gcloud.compute.instances.create) could not parse resource []

this is not working for us-west1-b zone.


Somebody is facing this issue, finally I got the solution for the new cloud terminal syntax.

Ans:
gcloud compute instances create gcelab2 --machine-type e2-medium --zone='us-west1-b'
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-6fba5558b812/zones/us-west1-b/instanc...].
NAME: gcelab2
ZONE: us-west1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE:
...

Solved Solved
0 2 2,035
1 ACCEPTED SOLUTION

Thanks for the solution.

View solution in original post

2 REPLIES 2

Hi @S_Majumder2003,

Welcome to Google Cloud Community!

Thank you for sharing your insights on potential solutions. The first command you provided gcloud compute instances create gcelab2 --machine-type e2-medium --zone=$ZONErequires the $ZONE to be set or exported as us-west1-b.

To export $ZONE, you can execute the following command :

 

 export ZONE=us-west1-b

 

To verify if $ZONE has been successfully exported run the command below. The output should display us-west1-b :

 

echo $ZONE

 

If you prefer not to use $ZONE you can directly specify the zone using the second command you provided. For further information you can check this guide Create Compute Instances.

I hope the above information is helpful.

Thanks for the solution.

Top Labels in this Space