Skip to content

Instantly share code, notes, and snippets.

@crizstian
Created April 12, 2019 18:52
Show Gist options
  • Save crizstian/ca6373a77e99e9019c6361dae31a39c5 to your computer and use it in GitHub Desktop.
Save crizstian/ca6373a77e99e9019c6361dae31a39c5 to your computer and use it in GitHub Desktop.
DBS=`aws ec2 describe-instances --filters "Name=tag:Name,Values=*Mongo*" --query 'Reservations[].Instances[].PrivateIpAddress' --region $AWS_DEFAULT_REGION`
DB1=`echo $DBS | jq .[0] | sed -e 's/"//g'`
DB2=`echo $DBS | jq .[1] | sed -e 's/"//g'`
DB3=`echo $DBS | jq .[2] | sed -e 's/"//g'`
echo "export DB1=${DB1}" >> /etc/environment
echo "export DB2=${DB2}" >> /etc/environment
echo "export DB3=${DB3}" >> /etc/environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment