Saravanan G
Saravanan G

Reputation: 581

Google Cloud gcloud command showing "Machine type with name 'f1-micro--subnet=default' does not exist in zone 'us-east1-b'"

I'm now learning Google Cloud Platform instance creation. As part of learning, trying to launch RHEL 6 instance on a f1.micro instance-type in us-east1-b region.

Here's is the Gcloud command I've used:

gcloud compute --project=<project-id> instances create cldinit-vm --zone=us-east1-b --machine-type=f1-micro--subnet=default --network-tier=PREMIUM --metadata-from-file startup-script=initscript.sh --maintenance-policy=MIGRATE --service-account=<account-id>@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --min-cpu-platform="Intel Broadwell" --tags=http-server --image=rhel-6-v20181210 --image-project=rhel-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=cldinit-vm --labels=name=cloudinit-vm

When I run the command, it is showing the error below,

ERROR: (gcloud.compute.instances.create) Could not fetch resource:
- Invalid value for field 'resource.machineType': 'https://www.googleapis.com/compute/v1/projects/<project-id>/zones/us-east1-b/machineTypes/f1-micro--subnet=default'. 
Machine type with name 'f1-micro--subnet=default' does not exist in zone 'us-east1-b'.

I've two questions:

  1. I could not modify the Subnet settings from "default", as it is the only option available to choose from "network" in instance launching page. So could anyone help to resolve the issue please?
  2. Since I'm learning GCP, I've launched the CLI command into "CloudShell" directly from the link located at bottom of GCP compute engine - instance launching page. Is there a correction needs to be done from "Google" to provide the working command ?

Upvotes: 0

Views: 1235

Answers (1)

Saravanan G
Saravanan G

Reputation: 581

As part of learning, found that there was a missing space in between the option value f1-micro and --subnet. So here is the corrected command snippet

gcloud compute --project=<project-id> instances create cldinit-vm --zone=us-east1-b --machine-type=f1-micro --subnet=default ....

Upvotes: 1

Related Questions