1

I am spinning up a google compute instance and have a systemd unit that invokes a script which in turn calls gcloud components update -q. I've put this gcloud call in a loop that retries until it succeeds in the bash script. It appears that this fails until I have assigned an external IP address to the system. I would prefer not to assign an external IP address, and I don't think an external IP address is important to the functionality of gcloud, so I'd like to understand what additional things does adding an external IP address to a compute instance do? Perhaps by knowing that I can make sure I am configuring my instance appropriately. Alternatively, what do I need to do to be able to use gcloud from within my compute instance? Thanks in advance!

Zach
  • 131
  • 4

1 Answers1

1

By running gcloud components update -q the command will try to communicate with an external IP address to download update files. If your VM instance has only internal IP address then command will fail, because an internal (private) IP address cannot communicate with external (public) IP addresses directly.

In order to run gcloud command you will need to assign an external IP address to your VM or you can use a NAT gateway front of your VM instance.

Kamran
  • 1,425
  • 7
  • 17