Any time doing hand-rolled on demand spinning up of ec2 instances, be sure they are properly spun down later.
It's very easy to get hit with a massive bill due to just leaving instances around.
It's very easy to get hit with a massive bill due to just leaving instances around.
sudo shutdown +15 (or other amount of minutes)
when I need a compute instance and don’t want to forget to turn it off. It’s a simple trick that will save you in some cases.
/5 * * * [ -f /var/run/keepalive ] && [ $(( $(date +\%s) - $(stat -c \%Y /var/run/keepalive) )) -gt 7200 ] && shutdown -h now