Skip to content

Instantly share code, notes, and snippets.

@hokkai7go
Created January 11, 2017 02:52
Show Gist options
  • Save hokkai7go/8a8ddf250cd35b437543e049e885a969 to your computer and use it in GitHub Desktop.
Save hokkai7go/8a8ddf250cd35b437543e049e885a969 to your computer and use it in GitHub Desktop.
EC2インスタンスの一覧を出したときのスクリプト
AWS_PROFILE=hoge aws ec2 describe-instances | jq -r '["InstanceName","PrivateIpAddress","PublicIpAddress","InstanceId","InstanceType","AvailabilityZone","State.Name","Platform"],(.Reservations[].Instances[] | [(.Tags[] | select(.Key=="Name").Value) // "", .PrivateIpAddress, .PublicIpAddress, .InstanceId, .InstanceType, .Placement.AvailabilityZone, .State.Name, .Platform])|@csv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment