ESB Dev
ESB Dev

Reputation: 1

Want to create a VM instance in Google Cloud Platform by using CLI

Trying to create a VM instance in Google Cloud Platform. Getting error in the mentioned process. Trying to resolve it.

Error: **Could not fetch a resource:

Anyone, please guide me. My intention to make VM creation automated and make it simple by putting it all together in an automated Bash Script.

Upvotes: 0

Views: 968

Answers (1)

Alfons Muñoz
Alfons Muñoz

Reputation: 519

The error indicates that the URL is malformed. It probably because that "subnetwork" does not exist as you write it.

One way to fix it is to have a look in the documentation to know the right way to write the command. Also be sure that that subnet exist in your GCP project.

https://cloud.google.com/vpc/docs/create-use-multiple-interfaces

The easy way to avoid typos is to create the VM in the console the first time (you don't really have to create it, just start the form), at the bottom of the page you will see a line that says "Equivalent REST or command line", click in "command line" to see exactly the CLI command equivalent to the VM you are configuring. Use this command line in your CLI console or script.

Equivalent REST or command line

Clicking in the "command line" will return something like:

gcloud compute instances create VM_NAME \
    --network=NETWORK_NAME \
    --subnet=SUBNET_NAME \
    --zone=ZONE

with all the parameters already filled in for you.

Upvotes: 3

Related Questions