1

I want to configure a static hostname for my google cloud VM instance as currently its reverted to default hostname once the instance is restarted.

I have followed a few tutorials but none of those worked and thus need a permanent solution.

Regards

1 Answers1

1

The hostname in Google Cloud Platform is used for internal DNS resolution by the metadata server and is part of the default metadata for your instance. Changing it would break a few things. If you want to check what's your instance's hostname registered on the metadata server you would do this:

curl http://metadata.google.internal/computeMetadata/v1/instance/hostname -H "Metadata-Flavor: Google"

But actually changing that metadata manually is not possible, but there are several workarounds that might work for you. See this other answer

Tux
  • 2,039
  • 8
  • 22