Terminate Amazon EC2 instance using shutdown


I can terminate Amazon EC2 instances using the API command ec2-terminate-instances but I’m trying to find out how to do this while logged onto the EC2 instances themselves.

I’ve tried shutdown -h now but this only “stops” the instance, without fully terminating it.

Is there any way to do this?


There is an option that you can set at instance creation that will allow the instance to terminate on shutdown.

If you’re using the ec2 command line tools, add the option: --instance-initiated-shutdown-behavior terminate

After creating an instance with that option, issuing the shutdown -h now command from within the instance will terminate it instead of stopping it.

Leave a Reply