jq

Table of Contents

jq

AWS Health Check IP を抜き出す

$ curl -s https://ip-ranges.amazonaws.com/ip-ranges.json |jq '.prefixes' | jq 'map(select(.["service"] == "ROUTE53_HEALTHCHECKS"))' | jq 'map(select(has("ip_prefix")))'  | jq '.[]."ip_prefix"'

Dynamoのテーブル定義を抜き出す

$ aws dynamodb describe-table --table-name hoge |  jq '.Table' | jq 'del(.TableSizeBytes)' | jq 'del(.TableStatus)' | jq 'del(.ProvisionedThroughput.NumberOfDecreasesToday)' | jq 'del(.ProvisionedThroughput.LastIncreaseDateTime)' | jq 'del(.ProvisionedThroughput.LastDecreaseDateTime)' | jq 'del(.CreationDateTime)' | jq 'del(.ItemCount)'  | jq 'del(.TableArn)' | jq 'del(.TableId)' > hoge.json

EC2のIDと名前を抜き出す

$ aws ec2 describe-instances | jq '.Reservations[].Instances[] | { (.InstanceId) : .Tags[] | select(.Key == "Name") .Value}'

LambdaのConcurrency設定を抜き出す

$ aws lambda list-functions | jq '.Functions[].FunctionName ' |  while read line ; do  aws lambda get-function --function-name ${line//\"/}; done | jq '{(.Configuration.FunctionName) : .Concurrency}'

emacs

Validate