Jürgen Grech
Jürgen Grech

Reputation: 1

Can't define network when creating instance group with gcloud

Whilst it is possible to select "network" and "subnetwork" when creating an instance group in Google Cloud Platform Console, I get the following when I try to assign a network to a newly created Instance Group using gcloud:

gcloud compute instance-groups unmanaged create my-instance-group-1 --network my-net1 --subnetwork my-vpc-dmz0 --zone europe-west1-b
ERROR: (gcloud.compute.instance-groups.unmanaged.create) unrecognized arguments:
  --network
  my-net1
  --subnetwork
  my-vpc-dmz0

Upvotes: 0

Views: 975

Answers (1)

Kristen Tracey
Kristen Tracey

Reputation: 152

These flags do not exist on that command.

For unmanaged instance groups specifically, you create a group and then add instances using gcloud compute instance-groups unmanaged add-instances. You would add the network or subnet (note that the flag is named --subnet, not --subnetwork) at the time that you create each instance, not while creating the instance group.

Or, you could create a single instance template using gcloud compute instance-templates create --subnet my-subnet, and then create a managed instance group from that template. That might be closer to what you're trying to do.

More info here - https://cloud.google.com/compute/docs/instance-groups/

Upvotes: 1

Related Questions