Skip to content

Instantly share code, notes, and snippets.

@sandeepkunkunuru
Last active December 10, 2018 14:59
Show Gist options
  • Save sandeepkunkunuru/5bc866886fcca2535775d863a913ccde to your computer and use it in GitHub Desktop.
Save sandeepkunkunuru/5bc866886fcca2535775d863a913ccde to your computer and use it in GitHub Desktop.
awless : stop, start instances

Awless template to start/stop a list of instances

#!/usr/bin/env bash
set -ex
AWS_DEFAULT_REGION=xxxx
AWS_DEFAULT_PROFILE=xxxx
awless config set aws.region ${AWS_DEFAULT_REGION}
awless config set aws.profile ${AWS_DEFAULT_PROFILE}
SCRIPT_HOME=/home/xxx/scripts/awless
DATA_HOME=/home/xxx/cloud/data
function join_by { local IFS="$1"; shift; echo "$*"; }
#!/usr/bin/env bash
source ../env.sh
instances=( $(cut -d ',' -f1 ${DATA_HOME}/instances.csv ) )
printf "%s\n" "${instances[0]}"
echo "starting instances ---> "`join_by , "${instances[@]}"`
awless start instance id=`join_by , "${instances[@]}"`
#!/usr/bin/env bash
source ../env.sh
instances=( $(cut -d ',' -f1 ${DATA_HOME}/instances.csv ) )
printf "%s\n" "${instances[0]}"
echo "Stopping instances ---> "`join_by , "${instances[@]}"`
awless stop instance id=`join_by , "${instances[@]}"`
i-xxxxxxxx xxx xxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment