Last active
November 20, 2019 12:26
-
-
Save christianromney/d0e2fcd2afd81c7ca5deecd41abb6ffb to your computer and use it in GitHub Desktop.
Bash script to get the Datomic Cloud system name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eo pipefail | |
if [[ "$#" -eq 0 ]]; then | |
cat <<EOF | |
usage: $(basename $0) <REGION> [OPTIONS] | |
REGION - a valid AWS region e.g. us-east-1 | |
OPTIONS - any valid AWS CLI options e.g. --profile home | |
EOF | |
else | |
region="${1}" | |
shift | |
aws ec2 describe-instances --region ${region} \ | |
--filters "Name=tag-key,Values=datomic:tx-group" "Name=instance-state-name,Values=running" \ | |
--query 'Reservations[*].Instances[*].[Tags[?Key==`datomic:system`].Value]' \ | |
--output text \ | |
$* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment