使用shutdown终止Amazon EC2实例 [英] Terminate Amazon EC2 instance using shutdown

查看:148
本文介绍了使用shutdown终止Amazon EC2实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用API​​命令 EC2-终止实例但我试图找出如何做到这一点的同时登录到EC2实例本身终止的Amazon EC2实例。

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.

我已经试过 shutdown -h now中,但这只是停止的情况下,没有完全结束了。

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.

如果您使用的EC2命令行工具,添加选项: - 实例启动 - 关闭 - 行为终止

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

创建与该选项的实例,从实例中发出 shutdown -h now中命令将终止它,而不是阻止它之后。

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终止Amazon EC2实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆