Skip to content

Instantly share code, notes, and snippets.

@asvinours
Created October 28, 2021 16:02
Show Gist options
  • Save asvinours/3574f03dd35738afabf74e8a59b6184f to your computer and use it in GitHub Desktop.
Save asvinours/3574f03dd35738afabf74e8a59b6184f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -eEo pipefail
FILTER_VALUE="${1}"
INSTANCE_ATTRIBUTE="${2:-InstanceId}"
aws ec2 describe-instances --filters "Name=tag:Name,Values=$FILTER_VALUE" | jq -r ".Reservations[].Instances[].$INSTANCE_ATTRIBUTE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment