Skip to content

Instantly share code, notes, and snippets.

@adampats
Last active February 29, 2016 22:36
Show Gist options
  • Select an option

  • Save adampats/55b2d814813eed60e000 to your computer and use it in GitHub Desktop.

Select an option

Save adampats/55b2d814813eed60e000 to your computer and use it in GitHub Desktop.
aws spot instance requests jq parsing
{
"CreateTime": "2016-02-29T18:18:48.000Z",
"ImageId": "ami-f7a2bf96",
"InstanceType": "m4.large",
"SpotInstanceRequestId": "sir-039b6k6b",
"SpotPrice": "0.030000",
"State": "cancelled",
"Status": {
"Code": "instance-terminated-by-user",
"Message": "Spot Instance terminated due to user-initiated termination.",
"UpdateTime": "2016-02-29T18:31:29.000Z"
},
"Type": "persistent"
}
aws ec2 describe-spot-instance-requests | \
jq -S '.|.SpotInstanceRequests[]|{Status,SpotInstanceRequestId,State,Type,CreateTime,SpotPrice,InstanceType:(.LaunchSpecification.InstanceType),ImageId:(.LaunchSpecification.ImageId)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment