Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check if an ec2 instance is spot or normal lifecycle
#!/usr/bin/env bash
aws ec2 describe-spot-instance-requests \
--filters Name=instance-id,Values="$(wget -q -O -" \
--region "$(wget -q -O - | jq -r '.region')" | \
jq -r '.SpotInstanceRequests | if length > 0 then "spot" else "normal" end'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.