Skip to content

Instantly share code, notes, and snippets.

@christianromney
Last active November 20, 2019 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianromney/d0e2fcd2afd81c7ca5deecd41abb6ffb to your computer and use it in GitHub Desktop.
Save christianromney/d0e2fcd2afd81c7ca5deecd41abb6ffb to your computer and use it in GitHub Desktop.
Bash script to get the Datomic Cloud system name
#!/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