简体   繁体   English

使用shutdown终止Amazon EC2实例

[英]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. 我可以使用API​​命令ec2-terminate-instances来终止Amazon EC2实例,但我正在尝试在登录EC2实例本身时找到如何执行此操作。

I've tried shutdown -h now but this only "stops" the instance, without fully terminating it. 我已经尝试了shutdown -h now但是这只会“停止”实例,而不会完全终止它。

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 如果您使用的是ec2命令行工具,请添加选项: - --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. 使用该选项创建实例后,从实例中发出shutdown -h now命令将终止它而不是停止它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM