简体   繁体   English

使用libcloud为gce实例创建sshKeys

[英]Creating sshKeys for gce instance using libcloud

I need help! 我需要帮助! I am trying to create sshKeys (protocol pub_key username) for gce instance using libcloud API create_node with parameter ex_metadata while creating an instance. 我正在尝试在创建实例时使用带有参数ex_metadata libcloud API create_nodeex_metadata实例创建sshKeys (协议pub_key用户名)。 But username value is not getting saved when I check in google cloud console after the creation of instance. 但是创建实例后在Google Cloud Console中签入时,用户名值未保存。

Is there any different format to send sshKeys for metadata? 有没有其他格式可以发送用于元数据的sshKeys I am sending data like this, 我正在发送这样的数据,

metadata = {"items": [{"value": value, "key": "sshKeys"}]}

I'm not familiar with libcloud, however if you were using the gcloud compute instances create and you want to pass SSH keys with the flag --metadata KEY=VALUE, you need to do it as 我对libcloud并不熟悉,但是,如果您使用的是gcloud计算实例create,并且想通过标志--metadata KEY = VALUE传递SSH密钥,则需要这样做

-–metadata “sshKeys=username:ssh-rsaAAAAADAQABA....." . -–metadata “sshKeys=username:ssh-rsaAAAAADAQABA....."

So it might be something like: 所以可能是这样的:

metadata = {"items": [{"value": username:ssh-rsaAAAAADAQABA....., "key": "sshKeys"}]}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM