如何停止Amazon Aws EC2实例? [英] how to stop Amazon Aws EC2 instance?

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

问题描述

我正在尝试编写脚本以在星期五停止我们的测试环境中的多个实例,并让它们在星期一重新开始,以节省很少的成本.

I'm trying to write a script to stop several instances in our test environment on Friday and have them start back on Monday, to save little cost.

是否可以通过IP地址(而不是通过实例ID)或其他我不知道的方式来停止实例?(原因是如果必须删除并重新创建实例,则实例ID可能会更改.)

Is there a way to stop instances by IP addresses (and not by instance ID), or some other way I don't know about? (The reason being that instance ID's may change if an instance had to be deleted and recreated.)

推荐答案

这是零代码解决方案:

将您的实例放入自动伸缩组,并在自动伸缩组上添加关闭和启动时间表.这可以在AWS控制台中完成.

Put your instances into autoscale groups and add a shutdown and startup schedule on the autoscale group. This can be done in the AWS console.

这也可以使用AWS CLI自动化.

This can also be automated using the AWS CLI.

这篇关于如何停止Amazon Aws EC2实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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