Amazon EC2 的替代工具?
Amazon 与 EC2 交互的官方工具有点笨重且难以处理。 我必须设置一堆环境变量,为 EC2 存储单独的私钥,向我的 PATH 添加额外的项目,等等。 它们都输出制表符分隔的行,长度为数百个字符,没有标题,因此解释它们有点困难。 他们关于设置 SSH 密钥对的说明为您提供了一个不受密码保护的密钥对,而不是让您使用已有的现有密钥对。 这些程序都有点笨重,而且都不是很好的 Unix 程序。
那么,有没有更容易使用的命令行工具来访问EC2呢? 我知道有 ElasticFox,并且有他们基于 Web 的控制台,这确实使该过程变得更容易,但我想知道是否有其他人编写了更好的命令行工具来与 EC2 交互。
Amazon's official tools for interacting with EC2 are kind of clunky and a pain to deal with. I have to set up a bunch of environment variables, store separate private keys just for EC2, add extra items to my PATH, and so on. They all output tab delimited lines that are hundreds of characters long with no headings, so it's a bit of a pain to interpret them. Their instructions for setting up an SSH keypair give you one that isn't protected by a passphrase, rather than letting you use an existing keypair that you already have. The programs are all just a bit clunky and aren't very good Unix programs.
So, are there any easier to use command line tools for accessing EC2? I know there is ElasticFox, and there is their web based console, which do make the process easier, but I'm wondering if anyone else has written better command line tools for interacting with EC2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我有点晚了,但我有一个解决方案!
我发现 Amazon AMI 工具也存在同样的问题。 它们是一个不错的参考实现,但很难使用,特别是当您有多个实例时。 我编写了一个名为 Rudy 的替代命令行工具,作为另一个项目的一部分,它可以回答您的大部分问题。
这些命令比 Amazon 的 AMI 工具更直观:
rudy-ec2 实例 -C
rudy- ec2 groups -A -p 8080 -a 11.22.33.44 组名
rudy-ec2 卷 -C -s 100
rudy-ec2 图像
全部配置位于单个文件中(
~/.rudy/config
)。它可以以多种格式输出(yaml、json、csv、tsv,当然还有常规文本):
关于私钥,没有 EC2 工具允许使用密码创建私钥来启动公共实例因为API不支持它。 但是,如果您创建自己的映像,则可以使用您的私钥。
以下是更多信息:
I'm a bit late but I have a solution!
I found the same problems with the Amazon AMI tools. They're a decent reference implementation but very difficult to use particularly when you have more than a couple instances. I wrote a replacement command-line tool as part of another project, called Rudy that answers most of your concerns
The commands are more intuitive than Amazon's AMI tools:
rudy-ec2 instances -C
rudy-ec2 groups -A -p 8080 -a 11.22.33.44 group-name
rudy-ec2 volumes -C -s 100
rudy-ec2 images
All configuration is in a single file (
~/.rudy/config
).It can output in several formats (yaml, json, csv, tsv, and of course regular text):
Regarding the private keys, There are no EC2 tools that allow to create private keys for with a password for booting a public instance because the API doesn't support it. However, if you create your own image, you can use your private keys.
Here's more info:
ElasticFox 对于大多数任务来说都很方便。 但有时命令行工具更适合。 我个人使用 python 的 boto 库。 编写所有所需操作的脚本非常容易。 您还可以使用它从 S3 上传/下载文件。 一般来说,我认为 Python 或 RUby 等脚本语言与 AWS 库一起是最好的解决方案。
ElasticFox is handy for most tasks. They are occasions though that a command line tool will be better suited. I personally use boto library for python. It is very easy to script all the required operations. You can also use it to upload/download files from S3. In general, I would say that a scripting language like Python or RUby, together with a AWS library, is the best solution.
我个人使用 Tim Kay 的 Perl 命令行工具,并且已经有一段时间没有使用原始的基于 Java 的 API 了。 非常适合 UNIX 环境。
I personally use Tim Kay's Perl command line tools and haven't used original Java based API for quite some time. Excellent for UNIX environment.
不是命令行,但看看免费的 RightScale 帐户将为您提供什么 - 比命令简单得多线或 ElasticFox IMO。
Not command line, but take a look at what a free RightScale account will give you - much, much easier than command line or ElasticFox IMO.
关于 ec2-api-tools:
我同意它们有点太笨重,我特别不喜欢 ec2-describe-instances 的输出。
我最近切换到 python-boto,它为 ec2 提供了一个非常干净且易于使用的界面。
关于无法为 EC2 生成的 ssh 密钥指定密码:
情况并非如此。 您可以随时更改任何 ssh 私钥的密码,使用:
例如,
关于上传您自己的 ssh 密钥对:
您可以使用 ec2-import-keypair,如下所示:
上面的示例将在 ~/.ssh/id_rsa 中上传公钥.pub 以“mykey”名称发布到每个区域。 请记住,每个区域都有自己的密钥对。
为了将密钥安装在您的 ec2 实例中,您必须将“-k mykey”选项传递给 ec2-run-instances。
顺便说一句,上传您自己的密钥对是使用同一密钥登录所有区域的所有实例的唯一方法。 如果您从 Web 界面创建密钥对,则每个区域都会有不同的密钥。
About ec2-api-tools:
I agree that they are a bit too clunky, I particular dislike the output of ec2-describe-instances.
I recently switched to python-boto which offers a very clean and easy to use interface to ec2.
About not being able to specify a passphrase for the ssh key generated by EC2:
That's not the case. You can change the passphrase of any ssh private key anytime, using:
E.g.
About uploading your own ssh key pair:
You can use ec2-import-keypair, like this:
The example above will upload the public key in ~/.ssh/id_rsa.pub to every region under the name "mykey". Remember that each region has it's own keypair.
In order to have the key installed in your ec2 instances, you'll have to pass the "-k mykey" option to ec2-run-instances.
Incidentally, uploading your own keypair is the only way to login with the same key to all the instances in all regions. If you create the keypair from the web interface, you'll have a different key in every region.
我有一个名为 EC2Dream 的开源图形系统管理工具,它取代了命令行工具。 它安装在 Windows、Linux 和 Mac OS 客户端上,并使用 Ruby 和 FXRuby 编写。 请参阅 www.ec2dream.com。
尼尔·特纳
www.ec2dream.com
I have an open source graphical system admin tool called EC2Dream that replaces the command line tool. It installs on windows, linux and Mac OS clients and is written in Ruby and FXRuby. See www.ec2dream.com.
Neill Turner
www.ec2dream.com
如果您使用 Windows,请尝试下面链接的工具(O2 平台的一部分),它为您提供了一种简单的启动和停止方法Amazon EC2 映像(如果您需要扩展该工具,您可以轻松添加新功能(因为它只是动态编译和执行的 C# 脚本)
If you use windows, try the tool linked below (part of the O2 Platform) which gives you an easy way to start and stop Amazon EC2 images (and if you need to extend the tool it you can easily add new features (since it just an C# script that is dynamically compiled and executed)
替代库的问题在于它们并不总是保持最新,因此如果发布了 AWS 的新功能,那么您需要等待。 您发布说您的主要问题是一堆环境变量,向您的 PATH 添加额外的项目等。我们有这个
BitNami 上的问题,也是我们创建 BitNami 云工具,将所有 AWS 命令行工具与预配置的 Java 和 Ruby 语言运行时一起提供。 您只需下载它,您需要的所有内容都会安装在一个文件夹中,而无需修改您的系统配置。 我们定期更新它。
the problem with alternative libraries is that they are not always kept up to date, so if new features for AWS are released, then you need to wait. You posted that your main problems are the bunch of environment variables, add extra items to your PATH, etc. We had this
issue at BitNami, and is the main reason we created BitNami Cloud Tools that ships all of the AWS command line tools together with preconfigured Java and Ruby language runtimes. You only have to download it and everything that you need will be installed in a folder without modify your system configuration. We keep it regularly up to date.
有一个名为云管理的整个行业试图解决此类问题。 Scalr 和 RightScale 以及该领域的领导者(免责声明:我在 Scalr 工作)。
云管理软件构建在 Amazon EC2 API 之上(通常构建在 Rackspace 等其他公共 IaaS 之上),并提供改进的用户界面以及自动化工具,如您提到的备份或 SSH 管理。 他们不提供严格意义上的更简单的命令行工具。 他们的目标是让与 Amazon EC2 的交互更加轻松。
市场上有不同的选项:
否则,您可以下载并自行安装源代码,因为它是在 Apache 2 许可证下发布的。
There is an entire industry called Cloud Management which try to solve this type of problems. Scalr and RightScale and the leaders in this sector (disclaimer: I work at Scalr).
Cloud management softwares are built on top of Amazon EC2 API (and usually on other public IaaS like Rackspace) and provide an improved user interface along with automation tools like backups or SSH management as you mentioned it. They don't provide easier command lines tools stricto sensu. Their goal is to make interaction with Amazon EC2 easier.
Different options are available in the market:
Otherwise you can download and install the source code yourself, as it is released under the Apache 2 license.