Fetch-url-http-3a-2f-2fmetadata.google.internal-2fcomputemetadata-2fv1-2finstance-2fservice Accounts-2f < 2025 >
/computeMetadata/v1/instance/service-accounts/default/email Result: my-app-sa@my-project.iam.gserviceaccount.com
Let's write. How to Fetch URL http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/ – The Complete Guide
To give you a better understanding of how to interact with this URL, here are some code examples:
The metadata server serves data in a JSON format, which can be accessed through a series of URLs. The most notable of these URLs is http://metadata.google.internal/computeMetadata/v1/ , which serves as the base path for metadata queries. – Even if a service account has wider
– Even if a service account has wider IAM permissions, the instance’s scopes limit what the metadata token can access.
The metadata server is mapped natively inside the host network to two primary routes: http://metadata.google.internal The Static Link-Local IP Address: http://169.254.169.254 View and query VM metadata | Compute Engine
def get_token(self): if self._expiry < time.time() + 60: # refresh 60s early resp = requests.get( "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token", headers="Metadata-Flavor": "Google" ) data = resp.json() self._token = data["access_token"] self._expiry = time.time() + data["expires_in"] return self._token The Ghost in the Metadata Each entry is
You will find sub-paths like:
curl -H "Metadata-Flavor: Google" \ "http://google.internal" Use code with caution. Copied to clipboard Using Python:
Here is a short story looking into the life of this specific data request. The Ghost in the Metadata – Even if a service account has wider
Each entry is a directory containing metadata about that service account. Typically, every GCE instance has at least the .
"serviceAccounts": [
Sometimes you have multiple service accounts attached to the same instance. For example:
