Currently i use the following command to get all instance id's from my stack in json format:
aws ec2 describe-instances --query Reservations[*].Instances[*].InstanceId --filters Name=tag-key,Values=aws:cloudformation:stack-name Name=tag-value,Values=Stack-Name-XYZ --output=json
This command works fine but returns the instance id's in a different order which I need to change. I need the instances in the output sorted by the Hostrecord (Route53::RecordSet) or by the Logical ID in ascending order. For example: I have three instances with Hostrecord project1-avad.name.com, project2-avad.name.com, project3-avad.name.com. I want to get the instance id from project1 first, etc.
Unfortunately the documentation of describe-instances does not show a way to sort the output.
Is it even possible to sort the output the way I want? If yes, where can I find the required documentation?