Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 423
OneSolitaryNoob Avatar asked Jul 03 '12 05:07

OneSolitaryNoob


1 Answers

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.

like image 59
keithhatfield Avatar answered Sep 22 '22 13:09

keithhatfield