Last active
March 6, 2017 14:24
-
-
Save okisanjp/158bc0498f751259ecd1 to your computer and use it in GitHub Desktop.
awscli + jqで開発マシンの/etc/hosts用出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### プライベートIPの場合 | |
$ aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | .PrivateIpAddress + "\t" + .Tags[].Value' | |
192.0.2.1 aws1.example | |
192.0.2.2 aws2.example | |
192.0.2.3 aws3.example | |
192.0.2.4 aws4.example | |
192.0.2.5 aws5.example | |
192.0.2.6 aws6.example | |
192.0.2.7 aws7.example | |
192.0.2.8 aws8.example | |
### パブリックIPの場合 | |
$ aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | .PublicIpAddress + "\t" + .Tags[].Value' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment