12
12

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.

AWSメタデータを簡単取得するawsmetaコマンド作った(キモはコマンド補完)

Last updated at Posted at 2015-10-20

できたー!

Demo

デモ動画見れば何が出来るか分かると思う。

asciicast

Install

ただのシェルスクリプト1個なので、PATHの通った好きなとこにコピーして使えばOK。bashの補完も作ったのでそれも読み込んでおくといい感じになる。

git clone https://github.com/kawaz/awsmeta.git
cp awsmeta/bin/awsmeta /usr/local/bin/
cp awsmeta/etc/bash_completion.d/awsmeta.sh /etc/bash_completion.d/

Usage

シンプルな感じに取得。深いパスや複数まとめても取れる。

$ awsmeta instance-type
t2.micro
$ awsmeta instance-type placement/availability-zone
t2.micro
ap-northeast-1c

Completion

補完が効く!これが重要。

$ awsmeta ins<TAB>
$ awsmeta instance-<TAB><TAB>
instance-action  instance-id      instance-type
$ awsmeta instance-i<TAB>
$ awsmeta instance-id
i-8c7e372e

今までは curl http://169.254.169.254/latest/meta-data/instance-id とか長くて補完も効かないタイプを強いられてたのが地味に辛かったので補完したかったんよホント…。

Git Repository

12
12
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
12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?