Retrieve EC2 instances information from all profiles and all regions concurrently. This tool is intended to use with interactive selection tools like peco or percol.
Dwonload the binary file for your platform from release page and move it where you want like below.
$ mv go-ec2list_linux_amd64 /usr/local/bin/go-ec2list
$ go get github.com/sudix/go-ec2list
See Configuring the AWS Command Line Interface - AWS Command Line Interface.
$ go-ec2list
You will get EC2 instances list.
Each line is tab separeted values.
Output Values
- Instance Name
- Instance ID
- Public IP
- Private IP
- Profile Name
- Availability zone
- Instance type
- Instance state
If you set -cachemin
option, go-ec2list caches results and uses that until it expires.
Value means expire minutes.
USAGE
$ go-ec2list -cachemin 10
The cache is stored to $HOME/.go-ec2list/cache
.
When -refresh
is specified, the cache will always be deleted and re-create cache regardless of -cachemin
option.
USAGE
$ go-ec2list -cachemin 10 -refresh
Set alias like below, and you can ssh login to the selected instance.
alias ec2="go-ec2list | peco | cut -f3 | xargs -I{} sh -c 'ssh "ec2-user@{}" </dev/tty' ssh"