Thursday, April 3, 2014

Get IP Address of Google Compute Engine Instance

Similar to AWS, Google Compute Engine also has a Metadata server. You can get the external IP address by this command:

curl "http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip"
 -H "X-Google-Metadata-Request: True"

Note that you need to include the additional header, otherwise your request will be rejected for security reasons. 

No comments:

Post a Comment