Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Small fixes for zsh, cleanup
  • Loading branch information
mqp committed Feb 15, 2019
1 parent e6ee23a commit 22a9b4c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions helpers.sh
Expand Up @@ -26,13 +26,13 @@ function moz-ec2 {
local FILTERS="Name=instance-state-name,Values=running"
if [ ! -z "$1" ]
then
FILTERS="$FILTERS Name=tag:env,Values=$1"
FILTERS="$FILTERS,Name=tag:env,Values=$1"
fi
if [ ! -z "$2" ]
then
FILTERS="$FILTERS Name=tag:aws:autoscaling:groupName,Values=$1-$2"
FILTERS="$FILTERS,Name=tag:aws:autoscaling:groupName,Values=$1-$2"
fi
local ALL=$(aws ec2 describe-instances --output json --filters $FILTERS)
local ALL=$(aws ec2 describe-instances --output json --filters "$FILTERS")
local OUTPUT=$(jq -r '.Reservations | map(.Instances) | flatten | .[] | [
((.Tags//[])[]|select(.Key=="env")|.Value) // "null",
((.Tags//[])[]|select(.Key=="aws:autoscaling:groupName")|.Value) // "null",
Expand Down Expand Up @@ -82,8 +82,7 @@ function moz-tunnel {
# to anything else because there is an ALB in front of the instance with a hardcoded DNS, and
# the instance won't talk to anyone except the ALB. The dev ALB is called postgrest-dev.reticulum.io.)
function moz-admin {
local BASTION=$(moz-ec2 prod bastion | awk "{print \$3}")
ssh -L "3000:postgrest.reticulum.io:3000" "$BASTION.reticulum.io" "${@:1}"
ssh -L "3000:postgrest.reticulum.io:3000" "$(moz-host prod bastion).reticulum.io" "${@:1}"
}

# moz-iex target ...cmd-args
Expand Down

0 comments on commit 22a9b4c

Please sign in to comment.