1 Answers
Every Compute Engine instance has access to a metadata service. The metadata service is used from within a Compute Engine Instance. Its useful if you want to find out information about the current instance like hostname or the IP address. Here is a use case: I want to write a script which creates a database on a Compute Engine instance, in order to do this, my script will need to know the IP address of the current instance I’m working in. If I didn’t have access to the metadata service, I would have to copy & paste the IP address into my script. However because we have access to the metadata service I can use the metadata service within my script to get the IP address for me. This means I can run my script on lots of different Compute Engine instances without having to adjust my script for each instance I use it in. This saves a lot of time!