使用 python boto 创建和下载 AWS ec2 密钥对 [英] Create and download an AWS ec2 keypair using python boto

查看:26
本文介绍了使用 python boto 创建和下载 AWS ec2 密钥对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难找到一种方法(如果可能的话)使用 Python Boto 库创建新的 AWS 密钥对,然后下载该密钥对.

解决方案

boto 中 create_keypair 方法返回的 Key 对象有一个save"方法.所以,基本上你可以做这样的事情:

<预><代码>>>>进口博托>>>ec2 = boto.connect_ec2()>>>key = ec2.create_key_pair('mynewkey')>>>key.save('/path/to/keypair/dir')

如果您想要更详细的示例,请查看 https://github.com/garnaat/paws/blob/master/ec2_launch_instance.py.

这有帮助吗?如果没有,请提供一些有关您遇到的问题的具体信息.

I'm having difficulty figuring out a way (if possible) to create a new AWS keypair with the Python Boto library and then download that keypair.

解决方案

The Key object returned by the create_keypair method in boto has a "save" method. So, basically you can do something like this:

>>> import boto
>>> ec2 = boto.connect_ec2()
>>> key = ec2.create_key_pair('mynewkey')
>>> key.save('/path/to/keypair/dir')

If you want a more detailed example, check out https://github.com/garnaat/paws/blob/master/ec2_launch_instance.py.

Does that help? If not, provide some specifics about the problems you are encountering.

这篇关于使用 python boto 创建和下载 AWS ec2 密钥对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆