github上最近有一个库叫jungle。
由于作者觉得官方的CLI命令太繁琐,命令行太长,于是做了一个参数类似于Linux命令的命令行工具。
地址
https://github.com/achiku/jungle
现在只支持EC2的查找,开关机,登录,以及ELB的查找。
安装
pip install jungle
可以看到后台它还是使用boto3作为基础库
You are using pip version 6.1.1, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting jungle
Downloading jungle-0.0.15.tar.gz
Collecting boto3==1.1.1 (from jungle)
Downloading boto3-1.1.1-py2.py3-none-any.whl (95kB)
100% |¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€| 98kB 1.8MB/s
Collecting click==5.1 (from jungle)
Downloading click-5.1-py2.py3-none-any.whl (65kB)
100% |¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€¨€| 65kB 1.6MB/s
Requirement already satisfied (use --upgrade to upgrade): jmespath<1.0.0,>=0.6.2 in /usr/lib/python2.7/dist-packages (from boto3==1.1.1->jungle)
Requirement already satisfied (use --upgrade to upgrade): botocore<1.2.0,>=1.1.0 in /usr/lib/python2.7/dist-packages (from boto3==1.1.1->jungle)
Collecting futures==2.2.0 (from boto3==1.1.1->jungle)
Downloading futures-2.2.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): python-dateutil<3.0.0,>=2.1 in /usr/lib/python2.7/dist-packages (from botocore<1.2.0,>=1.1.0->boto3==1.1.1->jungle)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.10 in /usr/lib/python2.7/dist-packages (from botocore<1.2.0,>=1.1.0->boto3==1.1.1->jungle)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/lib/python2.7/dist-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.2.0,>=1.1.0->boto3==1.1.1->jungle)
Installing collected packages: futures, boto3, click, jungle
Running setup.py install for jungle
Successfully installed boto3-1.1.1 click-5.1 futures-2.2.0 jungle-0.0.15
使用
ls命令
jungle ec2 ls
web1 running i-b7d7b95e 172.31.xxx xxx.xxx.xxx.xxx
web2 running i-dad9b733 172.31.xxx xxx.xxx.xxx.xxx
web3 running i-dbd9b732 172.31.xxx xxx.xxx.xxx.xxx
DB1 running i-b6d7b95f 172.31.xxx xxx.xxx.xxx.xxx
DB2 running i-49d9b7a0 172.31.xxx xxx.xxx.xxx.xxx
DB3 running i-f7a0cf1e 172.31.xxx xxx.xxx.xxx.xxx
表格说明:Name标签值,状态,nodeID,内网IP,外网IP
注意:实例一定要有Name标签,不然会不在列表中
命令说明
<span style="color:#ff0000;">jungle</span>
Usage: jungle [OPTIONS] COMMAND [ARGS]...
aws operation cli
Options:
--help Show this message and exit.
Commands:
ec2 EC2 CLI group
elb ELB CLI group
<span style="color:#ff0000;">jungle elb</span>
Usage: jungle elb [OPTIONS] COMMAND [ARGS]...
ELB CLI group
Options:
--help Show this message and exit.
Commands:
ls List ELB instances
<span style="color:#ff0000;">jungle ec2 </span>
Usage: jungle ec2 [OPTIONS] COMMAND [ARGS]...
EC2 CLI group
Options:
--help Show this message and exit.
Commands:
down Stop EC2 instance
ls List EC2 instances
ssh SSH to EC2 instance
up Start EC2 instance
现在这个库功能还稍显简陋,但也会获得一些特定目标层的青睐。
例如专门的EC2使用者(非运维人员)可以使用这个工具自己开关机。