|
- #!/bin/bash
- #
- # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
- #
- #
- # Delete test compute cloud instances
- #
- # Usage: new_bubble.sh config-file
- #
- # Environment variables
- #
- #
-
- SCRIPT="${0}"
- SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
- BUBBLE_ENV="/home/bubble/current/bubble-test.env"
-
- INSTANCES=aws ec2 describe-instances --filters "Name=tag:Test_instance,Values=${TEST_TAG_CLOUD}" --query "Reservations[].Instances[].InstanceId"
-
- INSTANCES_COUNT="${#INSTANCES[@]}"
-
- if [[ ${INSTANCES_COUNT} -gt 0 ]] ; then
-
- echo "Deleting ${INSTANCES_COUNT} test instances..."
- aws ec2 terminate-instances --instance-ids "$INSTANCES"
-
- else
- echo "No instances contains tag \"${TEST_TAG_CLOUD}\" to delete"
- fi
|