{
	"id": "a735496c-2552-4b40-b926-04fed80a3725",
	"created_at": "2026-04-06T00:16:55.227706Z",
	"updated_at": "2026-04-10T13:12:34.576676Z",
	"deleted_at": null,
	"sha1_hash": "4d1342415ddc0f38ab3f48ef0310dca0f49cfccc",
	"title": "gcloud compute instances add-metadata",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 95437,
	"plain_text": "gcloud compute instances add-metadata\r\nArchived: 2026-04-05 23:10:28 UTC\r\nNAME\r\ngcloud compute instances add-metadata - add or update instance metadata\r\nSYNOPSIS\r\ngcloud compute instances add-metadata INSTANCE_NAME [ --metadata = KEY = VALUE ,\r\n[ KEY = VALUE ,…]] [ --metadata-from-file = KEY = LOCAL_FILE_PATH ,[…]] [ --zone = ZONE ]\r\n[ GCLOUD_WIDE_FLAG … ]\r\nDESCRIPTION\r\ngcloud compute instances add-metadata can be used to add or update the metadata of a virtual machine\r\ninstance. Every instance has access to a metadata server that can be used to query metadata that has been\r\nset through this tool. For information on metadata, see https://cloud.google.com/compute/docs/metadata\r\nOnly metadata keys that are provided are mutated. Existing metadata entries will remain unaffected.\r\nIn order to retrieve custom metadata, run:\r\nSee more code actions.\r\ngcloud compute instances describe example-instance --zone\r\nus-central1-a --format=\"value(metadata)\"\r\nwhere example-instance is the name of the virtual machine instance you're querying custom metadata from.\r\nFor more information about querying custom instance or project metadata through the Cloud Platform\r\nConsole or the API, see https://cloud.google.com/compute/docs/storing-retrieving-metadata#querying_custom_metadata. If you are using this command to manage SSH keys for your\r\nproject, please note the risks of manual SSH key management as well as the required format for SSH key\r\nmetadata, available at https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys.\r\nEXAMPLES\r\nTo add metadata under key important-data to an instance named test-instance , run:\r\ngcloud compute instances add-metadata test-instance --metadata=important-data=\"2 plus 2 equals 4\"\r\nTo add multiple key-value pairs at once, separate them with commas:\r\nhttps://cloud.google.com/sdk/gcloud/reference/compute/instances/add-metadata\r\nPage 1 of 3\n\ngcloud compute instances add-metadata test-instance --metadata=important-data=\"2 plus 2 equals 4\",unimpo\r\nPOSITIONAL ARGUMENTS\r\nINSTANCE_NAME\r\nName of the instance to set metadata on. For details on valid instance names, refer to the criteria\r\ndocumented under the field 'name' at:\r\nhttps://cloud.google.com/compute/docs/reference/rest/v1/instances\r\nFLAGS\r\n--metadata = KEY = VALUE ,[ KEY = VALUE ,…]\r\nMetadata to be made available to the guest operating system running on the instances. Each\r\nmetadata entry is a key/value pair separated by an equals sign. Each metadata key must be unique\r\nand have a max of 128 bytes in length. Each value must have a max of 256 KB in length. Multiple\r\narguments can be passed to this flag, e.g., --metadata key-1=value-1,key-2=value-2,key-3=value-3 .\r\nThe combined total size for all metadata entries is 512 KB.\r\nIn images that have Compute Engine tools installed on them, such as the official images, the\r\nfollowing metadata keys have special meanings:\r\nstartup-script\r\nSpecifies a script that will be executed by the instances once they start running. For\r\nconvenience, --metadata-from-file can be used to pull the value from a file.\r\nstartup-script-url\r\nSame as startup-script except that the script contents are pulled from a publicly-accessible location on the web. For startup scripts on Windows instances, the following\r\nmetadata keys have special 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 , and sysprep-specialize-script-ps1 . For more information, see Running startup\r\nscripts. At least one of [--metadata] or [--metadata-from-file] is required.\r\n--metadata-from-file = KEY = LOCAL_FILE_PATH ,[…]\r\nSame as --metadata except that the value for the entry will be read from a local file. This is\r\nuseful for values that are too large such as startup-script contents. At least one of [--metadata]\r\nor [--metadata-from-file] is required.\r\n--zone = ZONE\r\nZone of the instance to set metadata on. If not specified, you might be prompted to select a zone\r\n(interactive mode only). gcloud attempts to identify the appropriate zone by searching for\r\nresources in your currently active project. If the zone cannot be determined, gcloud prompts you\r\nfor a selection with all available Google Cloud Platform zones.\r\nTo avoid prompting when this flag is omitted, the user can set the compute/zone property:\r\nhttps://cloud.google.com/sdk/gcloud/reference/compute/instances/add-metadata\r\nPage 2 of 3\n\ngcloud config set compute/zone ZONE\r\nA list of zones can be fetched by running:\r\ngcloud compute zones list\r\nTo unset the property, run:\r\ngcloud config unset compute/zone\r\nAlternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE .\r\nGCLOUD WIDE FLAGS\r\nThese flags are available to all commands: --access-token-file , --account , --billing-project , --\r\nconfiguration , --flags-file , --flatten , --format , --help , --impersonate-service-account ,\r\n--log-http , --project , --quiet , --trace-token , --user-output-enabled , --verbosity .\r\nRun $ gcloud help for details.\r\nNOTES\r\nThese variants are also available:\r\ngcloud alpha compute instances add-metadata\r\ngcloud beta compute instances add-metadata\r\nSource: https://cloud.google.com/sdk/gcloud/reference/compute/instances/add-metadata\r\nhttps://cloud.google.com/sdk/gcloud/reference/compute/instances/add-metadata\r\nPage 3 of 3",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"origins": [
		"web"
	],
	"references": [
		"https://cloud.google.com/sdk/gcloud/reference/compute/instances/add-metadata"
	],
	"report_names": [
		"add-metadata"
	],
	"threat_actors": [],
	"ts_created_at": 1775434615,
	"ts_updated_at": 1775826754,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/4d1342415ddc0f38ab3f48ef0310dca0f49cfccc.pdf",
		"text": "https://archive.orkl.eu/4d1342415ddc0f38ab3f48ef0310dca0f49cfccc.txt",
		"img": "https://archive.orkl.eu/4d1342415ddc0f38ab3f48ef0310dca0f49cfccc.jpg"
	}
}