19 releases (12 breaking)
0.14.1 | Mar 27, 2022 |
---|---|
0.13.0 | Aug 1, 2021 |
0.12.0 | Feb 23, 2021 |
0.9.1 | Dec 29, 2020 |
0.7.0 | Nov 24, 2020 |
#2193 in Command line utilities
44 downloads per month
47KB
1.5K
SLoC
ec2-search
Search EC2 instance easily
Installation
Cargo Install
With Rust's package manager cargo, you can install via:
$ cargo install ec2-search
If you install the latest master branch commit
$ cargo install --git https://github.com/mocyuto/ec2-search --branch master
Homebrew
macOS or Linux
$ brew tap mocyuto/tap
$ brew install ec2-search
Setup Completion
If you install by brew
command, it is set automatically.
Otherwise, you run below.
# zsh
$ ec2s completion zsh > /usr/local/share/zsh/site-functions/_ec2s
# bash
$ ec2s completion bash > /usr/local/etc/bash_completion.d/ec2s
Usage
$ ec2s help
AWS credentials
ec2-search needs aws credentials, so you need to set credentials.
You can use Environment value or "~/.aws/credentials"
.
profile
if set and not empty the value of the environment variable AWS_PROFILE
otherwise default
Instance
Search instance info.
$ ec2s instance help
# or alias. see help
$ ec2s i help
info
display basic info
$ ec2s i info -q api
ID Name Status Type
i-012345678 test-api1 running t2.micro
counts: 1
# display wide when set -o option
$ ec2s i info -q api -o wide
ID Name Status Type PrivateDNS PrivateIP AZ LifeCycle
i-012345678 test-api1 running t2.micro ip-10-10-10-10.ap-northeast-1.compute.internal 10.0.0.1 ap-northeast-1 spot
# display tag column when set -T option
$ ec2s i info -q api -T Name,env
ID Name Status Type Name env
i-012345678 test-api1 running t2.micro test-api1 staging
# display all tag columns when set --show-all-tags option
$ ec2s i info -q api --show-all-tags
ID Name Status Type Name env
i-012345678 test-api1 running t2.micro test-api1 staging
instance ids
display instance ids
## like search
$ ec2s instance ids -q "api"
ID Name
i-012345678 test-api1
i-023456789 test-api2
counts: 2
instance ips
Display instance public and private IPs.
$ ec2s instance ips -q "api"
Private IP Public IP Name
10.0.0.1 test-api1
10.0.0.2 test-api2
counts: 2
instance DNS name
Display instance public and private DNS name
$ ec2s i dns -q api
Private DNS Public DNS Name
ip-10-10-10-10.ap-northeast-1.compute.internal test-api1
ip-10-10-10-11.ap-northeast-1.compute.internal test-api2
counts: 2
Target Group
$ ec2s target-group help
# or alias
$ ec2s tg help
Info
Display Target Group info
$ ec2s tg info -q api
Name TargetType LB
aaaaa-api ip ["aaaaa-bbbb-apialb"]
bbbbb-api ip ["bbbbb-cccc-apiinteralb"]
api-web instance ["prd-api-web"]
counts: 5
Target Health
Display Target Health
$ ec2s tg health -q api-web
ID Port Status
i-01002020202000101 80 healthy
counts: 1
Auto Scaling Group
$ ec2s auto-scaling-group help
# or alias
$ ec2s asg help
Info
Display Auto Scaling Group info
$ ec2s asg info -q eks
Name Instances Desired Min Max
prd-eks-autoscale 7 7 1 40
prd-eks-stateful 6 6 4 20
stg-eks-autoscale 1 1 1 20
stg-eks-stateful 2 2 1 10
counts: 4
Instances
Display Auto Scaling Group Instances.
$ ec2s asg inst -q stg-eks-api-autoscale
ID LifeCycle InstanceType AZ Status
i-01010101010101011 InService t3.medium ap-northeast-1c Healthy
counts: 1
Dependencies
~92MB
~1.5M SLoC