GCP Compute Engine — Common VM Actions
GCP Compute Engine — Common VM Actions 1. VM Metadata Every Compute Engine VM has a metadata server . Think of it as: Metadata server = a place where a VM can get information about itself. For example, a VM can retrieve information such as: VM name Zone Region Internal IP External IP Other instance information Why is this useful? It is especially useful with startup scripts and shutdown scripts . For example: VM starts ↓ Startup script runs ↓ Script asks Metadata Server: "What is my external IP?" ↓ Metadata Server returns the IP ↓ Script uses that IP The important part is that the script doesn't need you to manually enter the VM's IP address . Example Suppose you create 10 VMs. Instead of writing: VM1 → use 34.x.x.x VM2 → use 35.x.x.x VM3 → use 34.x.x.x you can create one reusable startup script : Get my external IP from metadata ↓ Use that IP to configure the application The same script can run on every VM. Key...