Google Compute Engine¶
Functions for working on Google Compute Engine instances.
from cloudy.google import compute_engine
See Google's Compute Engine Documentation.
check_is_google_compute_engine_instance()
¶
Determine whether a process is running on a Compute Engine instance.
Source code in cloudy/google/compute_engine.py
def check_is_google_compute_engine_instance() -> bool:
"""Determine whether a process is running on a Compute Engine instance."""
try:
socket.getaddrinfo("metadata.google.internal", 80)
except socket.gaierror:
return False
return True