I have instances in AWS that have the same ReservationId (they were launched at the same time and they have AmiLaunchIndex of 0 thru x ). My goal is to produce text output with one line per instance, such as this. I added column headers for clarity.
OwnerId ReservationId InstanceId PrivateIpAddress AmiLaunchIndex
12345678910 r-poiu4567 i-asdf1234 10.0.0.1 0
12345678910 r-poiu4567 i-qwer4312 10.0.1.1 1
... etc ...
In the jmespath gitter channel, the map function was suggested as a way to accomplish this, but I can't figure out how to use the function. Any suggestions?
Unfortunately, to do this right I think we'd need https://github.com/jmespath/jmespath.site/pull/6
In this particular case you can hack this result by using the owner in Network Interfaces, which is almost certain to be the same in practice:
Reservations[].Instances[].[NetworkInterfaces[0].OwnerId, InstanceId, KeyName]
(use an object instead of an array if you want the column headings)