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

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

问题描述

我有困难,找出办法(如果可能的话)来创建一个新的密钥对AWS使用了Python的Boto库,然后下载该密钥对。

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.

推荐答案

由create_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')

如果你想有一个更详细的例子,请查看的https:// github上。 COM / garnaat /爪/ BLOB /主/ ec2_launch_instance.py

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博托下载AWS EC2密钥对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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