gcloud compute project-info add-metadata Stay organized with collections Save and categorize content based on your preferences.
- 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-metadatacan 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/metadataOnly 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.,
. The combinedtotal size for all metadata entries is 512 KB.--metadatakey-1=value-1,key-2=value-2,key-3=value-3In 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,
can be used to pullthe value from a file.--metadata-from-file startup-script-url- Same as
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:startup-script,windows-startup-script-url,windows-startup-script-cmd,windows-startup-script-bat,windows-startup-script-ps1,sysprep-specialize-script-url,sysprep-specialize-script-cmd, andsysprep-specialize-script-bat. For moreinformation, seeRunning startupscripts.At least one of [--metadata] or [--metadata-from-file] is required.sysprep-specialize-script-ps1
--metadata-from-file=KEY=LOCAL_FILE_PATH,[…]- Same as
except that the valuefor the entry will be read from a local file. This is useful for values that aretoo large such as--metadatacontents.At least one of [--metadata] or [--metadata-from-file] is required.startup-script
- 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 helpfor details. - NOTES
- These variants are also available:
gcloudalphacomputeproject-infoadd-metadatagcloudbetacomputeproject-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.