Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jtbonhomme/6aef105289f23eba3890fb30b9b2f392 to your computer and use it in GitHub Desktop.
Save jtbonhomme/6aef105289f23eba3890fb30b9b2f392 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