From 173ea979e472bd175c2210aeb2a9f2895d32b92b Mon Sep 17 00:00:00 2001 From: Dan Grebb Date: Sat, 15 Jun 2024 23:41:58 -0400 Subject: [PATCH] feat(utils): add ECS start/stop commands to dg (#1292) --- _utils/_scripts/aws.sh | 21 +++++++++++++++++++++ _utils/dg | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 _utils/_scripts/aws.sh diff --git a/_utils/_scripts/aws.sh b/_utils/_scripts/aws.sh new file mode 100644 index 00000000..67976570 --- /dev/null +++ b/_utils/_scripts/aws.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +source $DGPATH/_scripts/functions.sh +env=$1 +CLUSTER_NAME=$(pass dg/aws/${env}/cluster/name) +SERVICE_ARN="$(pass dg/aws/${env}/cluster/service)" + +echo "AWS CLIing in ${env}" +while test "$2" != --; do + case $2 in + k | kill | stop) + echo "stopping ECS for ${env}" + echo + aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_ARN --desired-count 0 + break + ;; + s | start) + aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_ARN --desired-count 1 + break + ;; + esac +done diff --git a/_utils/dg b/_utils/dg index 5e2e4e11..294155d1 100755 --- a/_utils/dg +++ b/_utils/dg @@ -66,8 +66,8 @@ while test "$1" != --; do open https://github.com/users/dgrebb/projects/12 break ;; - a | act) - /bin/bash $DGPATH/_scripts/act.sh $2 $3 + a | aws) + /bin/bash $DGPATH/_scripts/aws.sh $2 $3 break ;; tp | test-performance)