Pages

Monday, February 3, 2014

Use AWS CLI and JQ to get a list of instances sorted by launch time

$ aws ec2 describe-instances | jq '.["Reservations"]|.[]|.Instances|.[]|.LaunchTime + " " + .InstanceId' | sort -n

Use the AWS CLI tools to generate a list instances, then pipe them to JQ to show only their launch time and instance id. Finally use sort to bring them out in runtime order. Find all those instances you launched months ago and have forgotten about.




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/1kCwSZ0

No comments:

Post a Comment