Fetch-url-http-3a-2f-2fmetadata.google.internal-2fcomputemetadata-2fv1-2finstance-2fservice Accounts-2f [verified] Online
Now let’s actually fetch the URL http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/ using different tools. All examples assume you are running inside a GCP resource (e.g., a Compute Engine VM with curl installed).
If you access:
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/ Now let’s actually fetch the URL http://metadata
If possible, use VPC firewalls to restrict access to 169.254.169.254 if it is not required by the application. 6. Token Management and Caching Expiration: Access tokens are short-lived.
– When creating a VM, you can limit which APIs the metadata token can access (e.g., read-only for Cloud Storage, no Compute API). Even if your app is compromised, the token has minimal permissions. Even if your app is compromised, the token
When someone searches for fetch-url-http-3A-2F-2Fmetadata.google.internal-2FcomputeMetadata-2Fv1-2Finstance-2Fservice accounts-2F , they are essentially looking for a guide on .
curl -H "Metadata-Flavor: Google" \ 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token' When you enable Workload Identity
curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/
GKE nodes run the metadata server as well. When you enable Workload Identity, your pods can access the metadata server to obtain tokens for the Kubernetes service account’s linked Google service account. The endpoint remains exactly the same.
This endpoint acts as a directory for all service accounts associated with a specific virtual machine or serverless instance.
# Using Application Default Credentials (recommended) import google.auth import google.auth.transport.requests