user-dataHello Pedro,
From the example above, it seems that you are using OpenStack to create a VM instance. Hence, if you are trying to create a VM instance on Google Compute Engine the above will not work.
In a nutshell, metadata is implemented differently in Google Compute Engine, and does not use cloud-init packages. A similar functionality to OpenStack “user-data” would be using a startup-script and shutdown-script, but with the difference that they execute every time you restart your instance. You may check the differences between Openstack and Google Compute Engine at this document.
Hello Pedro,
I am not suggesting to use OpenStack, as that was just my assumption that you are using it due to your code. If you are trying to use cloud-init, the package does not come pre-installed on any image on GCE with the exception of Container Optimized images like this example.
However, as I explained in my past message a startup/shutdown script is an alternative as per this document. That said, you may either use the key:” startup-script” or manually install cloud-init, and create a custom metadata as per this suggestion at this cloud-init document. If you chose the latter, I found this github page that could be helpful in setting up cloud-init with the correct metadata paths.
As for your last question, you seem to be using the correct client libraries for Node.js per this document.