gcloud compute project-info add-metadata

NAME
gcloud compute project-info add-metadata - add or update project-wide metadata
SYNOPSIS
gcloud compute project-info add-metadata[--metadata=KEY=VALUE,[KEY=VALUE,…]][--metadata-from-file=KEY=LOCAL_FILE_PATH,[…]][GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute project-info add-metadata can be used to add orupdate project-wide metadata. Every instance has access to a metadata serverthat can be used to query metadata that has been set through this tool.Project-wide metadata entries are visible to all instances. To set metadata forindividual instances, usegcloud computeinstances add-metadata. For information on metadata, seehttps://cloud.google.com/compute/docs/metadata

Only metadata keys that are provided are mutated. Existing metadata entries willremain unaffected.

If you are using this command to manage SSH keys for your project, please notetherisksof manual SSH key management as well as the required format for SSH keymetadata, available athttps://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys

FLAGS
--metadata=KEY=VALUE,[KEY=VALUE,…]
Metadata to be made available to the guest operating system running on theinstances. Each metadata entry is a key/value pair separated by an equals sign.Each metadata key must be unique and have a max of 128 bytes in length. Eachvalue must have a max of 256 KB in length. Multiple arguments can be passed tothis flag, e.g.,--metadatakey-1=value-1,key-2=value-2,key-3=value-3. The combinedtotal size for all metadata entries is 512 KB.

In images that have Compute Engine tools installed on them, such as theofficial images, thefollowing metadata keys have special meanings:

startup-script
Specifies a script that will be executed by the instances once they startrunning. For convenience,--metadata-from-file can be used to pullthe value from a file.
startup-script-url
Same asstartup-script except that thescript contents are pulled from a publicly-accessible location on the web.For startup scripts on Windows instances, the following metadata keys havespecial meanings:windows-startup-script-url,windows-startup-script-cmd,windows-startup-script-bat,windows-startup-script-ps1,sysprep-specialize-script-url,sysprep-specialize-script-cmd,sysprep-specialize-script-bat, andsysprep-specialize-script-ps1. For moreinformation, seeRunning startupscripts.At least one of [--metadata] or [--metadata-from-file] is required.
--metadata-from-file=KEY=LOCAL_FILE_PATH,[…]
Same as--metadata except that the valuefor the entry will be read from a local file. This is useful for values that aretoo large such asstartup-script contents.At least one of [--metadata] or [--metadata-from-file] is required.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
These variants are also available:
gcloudalphacomputeproject-infoadd-metadata
gcloudbetacomputeproject-infoadd-metadata

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.