How to avoid a forgotten EC2 bankrupting you
Quite often I find my self tinkering in my personal AWS account when dealing with OS or other services. One “gotcha” that can happen is a forgotten EC2 instance. Next thing you know your typical $1 monthly bill is now $20 or more.
I have this set in my instance by default (I do not maintain any long running ec2 instances). So if I spin a box up to play with something and I forget about it it will shutdown after 2 hours or inactivity. If it is a spot or if you change the shutdown behavior to terminate it will completely delete the instance and disk. Wore case you have a forgotten disk. Not $0 but better than a running instance.. Hope this helps
If it is a systemd os you can add: