google-compute-engine"/>
  • 13
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am working on application licensing part. As of we have a unique ID for VM's in AZURE and EC2 but I didn't see such ID for google cloud instances.

Is there any such ID available in the first place?

Google Cloud instances do have a unique ID that is assigned on creation by default.

Relative to http://metadata.google.internal/computeMetadata/v1/instance/

id The ID of the instance. This is a unique, numerical ID that is generated by Google Compute Engine. This is useful for identifying instances if you do not want to use instance names.

There are several ways of getting that metadata. From within an instance you can simply do:

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

And that will return the unique numerical ID for that instance. For more detailed information on querying the metadata see the documentation

  • 1
Reply Report
    • thanks jordi, But, does this ID will be unique in all projects in google cloud or will be unique to related to that current project only?

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags