Skip to content

Commit

Permalink
style(utils): improve ECS start/stop feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Aug 29, 2024
1 parent f6ef64c commit 7322070
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions _utils/_scripts/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,32 @@ env=$1
CLUSTER_NAME=$(pass dg/aws/${env}/cluster/name)
SERVICE_ARN="$(pass dg/aws/${env}/cluster/service)"

# Color codes
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

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
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_ARN --desired-count 0 >/dev/null
if [ $? -eq 0 ]; then
echo -e "${RED}STOPPED${NC}"
else
echo "Failed to stop the service."
fi
break
;;
s | start)
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_ARN --desired-count 1
aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_ARN --desired-count 1 >/dev/null
if [ $? -eq 0 ]; then
echo -e "${GREEN}STARTING...${NC}"
else
echo "Failed to start the service."
fi
break
;;
esac
Expand Down

0 comments on commit 7322070

Please sign in to comment.