Creating Labels in Google Cloud

Google Cloud Labels:

  1. Creating Instance With Labels:

Command Reference:

gcloud compute instances create [instance-name] –labels key=value key-value

Example:

gcloud compute instances create test2 –zone us-central1-a –labels env=prod,owner=raghav,component=frontend

2.  List Existing Labels:

Command Reference:

gcloud compute instances describe [instance-name] –format ‘default(labels)’

Example:
gcloud compute instances describe test2 –zone us-central1-a –format ‘default(labels)’
      3. Update Existing Labels:

Command Reference:

gcloud compute instances update [instance-name] –update-labels key=value, key=value

Example:
gcloud compute instances update test2 –zone us-central1-a –update-labels owner=seshu, state=readyfordeletion

4. Remove Existing Labels:

Command Reference:
gcloud compute instances update [instance-name] –remove-labels key1, Key2

Example:
gcloud compute instances update test2 –remove-labels state

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s