6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

EC2サーバのIPアドレスをコマンド一つで取得する

Last updated at Posted at 2015-01-29

前提

こんなことはありませんか?

  • EC2インスタンスを用途別にいくつも立ち上げている
  • Security Groupにて、踏み台サーバ経由で各アプリケーションサーバにSSHしている 参考
  • あれ、あのサーバのprivate ipって何だっけ?

コマンド

~/.bash_profile
alias ec2="aws ec2 describe-instances | jq '.Reservations | .[]' | jq '.Instances | .[]' | jq '.Tags[].Value + .PrivateIpAddress'"

結果

  • bashで ec2 と打つだけで、sshしたいサーバのIPが分かります! 便利!
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?