Stay organized with collections Save and categorize content based on your preferences.
Interfaces Options Variables BASE_PATHBASE_PATH = "/computeMetadata/v1"
GCE_LINUX_BIOS_PATHS
GCE_LINUX_BIOS_PATHS: {
BIOS_DATE: string;
BIOS_VENDOR: string;
}
Known paths unique to Google Compute Engine Linux instances
gcpResidencyCachegcpResidencyCache: boolean | null
A cache for the detected GCP Residency.
HEADER_NAME = "Metadata-Flavor"
HEADERS: Readonly<{ "metadata-flavor":="" "google";="" }="">
HOST_ADDRESS
HOST_ADDRESS = "http://169.254.169.254"
METADATA_SERVER_DETECTION
METADATA_SERVER_DETECTION: Readonly<{ 'assume-present':="" "don't="" try="" to="" ping="" the="" metadata="" server,="" but="" assume="" it's="" present";="" none:="" "don't="" try="" to="" ping="" the="" metadata="" server,="" but="" don't="" try="" to="" use="" it="" either";="" 'bios-only':="" "treat="" the="" result="" of="" a="" bios="" probe="" as="" canonical="" (don't="" fall="" back="" to="" pinging)";="" 'ping-only':="" "skip="" the="" bios="" probe,="" and="" go="" straight="" to="" pinging";="" }="">
Metadata server detection override options.
Available via process.env.METADATA_SERVER_DETECTION
.
SECONDARY_HOST_ADDRESS = "http://metadata.google.internal."
Functions detectGCPResidency()
export declare function detectGCPResidency(): boolean;
Determines if the process is running on Google Cloud Platform.
Returns Type Descriptionboolean
{boolean} true
if the process is running on GCP, false
otherwise.
export declare function getGCPResidency(): boolean;
Detects GCP Residency. Caches results to reduce costs for subsequent calls.
Returns Type Descriptionboolean
instance(options)
export declare function instance
Obtain metadata for the current GCE instance
Parameter Name Descriptionoptions
string | Options
Promise<T>
Type Parameter Type Description T
isAvailable()
export declare function isAvailable(): Promise
Determine if the metadata server is currently available.
Returns Type DescriptionPromise<boolean>
isGoogleCloudServerless()
export declare function isGoogleCloudServerless(): boolean;
Determines if the process is running on a Google Cloud Serverless environment (Cloud Run or Cloud Functions instance).
Uses the: - . - .
Returns Type Descriptionboolean
{boolean} true
if the process is running on GCP serverless, false
otherwise.
export declare function isGoogleComputeEngine(): boolean;
Determines if the process is running on a Google Compute Engine instance.
Returns Type Descriptionboolean
{boolean} true
if the process is running on GCE, false
otherwise.
export declare function isGoogleComputeEngineLinux(): boolean;
Determines if the process is running on a Linux Google Compute Engine instance.
Returns Type Descriptionboolean
{boolean} true
if the process is running on Linux GCE, false
otherwise.
export declare function isGoogleComputeEngineMACAddress(): boolean;
Determines if the process is running on a Google Compute Engine instance with a known MAC address.
Returns Type Descriptionboolean
{boolean} true
if the process is running on GCE (as determined by MAC address), false
otherwise.
export declare function project
Obtain metadata for the current GCP Project.
Parameter Name Descriptionoptions
string | Options
Promise<T>
Type Parameter Type Description T
requestTimeout()
export declare function requestTimeout(): number;
Obtain the timeout for requests to the metadata server.
In certain environments and conditions requests can take longer than the default timeout to complete. This function will determine the appropriate timeout based on the environment.
Returns Type Descriptionnumber
{number} a request timeout duration in milliseconds.
resetIsAvailableCache()export declare function resetIsAvailableCache(): void;
reset the memoized isAvailable() lookup.
Returns Type Descriptionvoid
setGCPResidency(value)
export declare function setGCPResidency(value?: boolean | null): void;
Sets the detected GCP Residency. Useful for forcing metadata server detection behavior.
Set null
to autodetect the environment (default behavior).
value
boolean | null
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4