Skip to content

Instantly share code, notes, and snippets.

@meyju
Created March 25, 2015 07:55
Show Gist options
  • Save meyju/c7138dc1b2cd5b94ddba to your computer and use it in GitHub Desktop.
Save meyju/c7138dc1b2cd5b94ddba to your computer and use it in GitHub Desktop.
Force aws instance start
#!/bin/bash
#
# Info: Script trys to start an aws instance, if the region is out of capacity
# Autor: Julian Meyer
# Version: 0.1
#
# USE AT YOUR OWN RISK!
if [ $# -lt 1 ]; then
echo "Usage: $0 [instance-id] [...]"
exit 1
fi
export AWS_DEFAULT_REGION="eu-central-1"
COUNTER=0
RC=1
while [ $RC -gt 0 ]
do
aws ec2 start-instances --instance-ids $@ 2>/dev/null
RC=$?
let COUNTER=COUNTER+1
echo "RC=$RC - `date` - Versuche: $COUNTER"
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment