To self-terminate an EC2 instance, follow the given steps:
- Start the instance with "--instance-initiated-shutdown-behavior terminate" or through the AWS console
-
Login as root user and run "shutdown -h now". On Ubuntu, you could set this up to happen in 55 minutes using:
echo "sudo halt" | at now + 55 minutes