Help us understand the problem. What is going on with this article?

jqを使ってAWS CLIの出力を見やすくしよう

例えばAWS CLIで RDSインスタンスの一覧を取得したい場合、、、

C:\Users\hoge>aws rds describe-db-instances
!!!!!JSONでずらずらと出力される!!!!!

見づらいので、jqを使って必要な出力に絞ります。
例)RDS一覧から、DBInstanceIdentifierのみ出力

C:\Users\hoge>aws rds describe-db-instances | jq '.DBInstances[].DBInstanceIdentifier'
jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Windows cmd shell quoting issues?) at <top-level>, line 1:
'.DBInstances[].DBInstanceIdentifier'
jq: 1 compile error

エラーになる。。。

Windowsだとシングルクオートではなくダブルクオートのようです。

C:\Users\hoge>aws rds describe-db-instances | jq ".DBInstances[].DBInstanceIdentifier"
"hoge-rds-01"
"hoge-rds-02"
"hoge-rds-03"
"hoge-rds-04"

また、-rオプションでダブルクオート抜きの出力となります。

C:\Users\hoge>aws rds describe-db-instances | jq -r ".DBInstances[].DBInstanceIdentifier"
hoge-rds-01
hoge-rds-02
hoge-rds-03
hoge-rds-04

[メモ]Postgresql RDSのログをきれいにみる方法

aws rds download-db-log-file-portion --db-instance-identifier hoge-postgresql --log-file-name error/postgres.log | jq -r ".LogFileData"
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away