terraform.aws-baseline-infra/modules/util/resource-list/list-ec2.sh

5 lines
294 B
Bash
Executable File

#!/bin/bash
# exclude ASG instances
RESULTS=$(aws ec2 describe-instances --query 'Reservations[].Instances[?!not_null(Tags[?Key == `aws:autoscaling:groupName`].Value)].InstanceId' --output text --no-cli-pager | sed 's/\t/\n/g' | sort | xargs)
jq -n --arg result "$RESULTS" '{"result":$result}'