简体   繁体   English

以编程方式挂起AWS实例

[英]Programmatically suspending an AWS instance

I have a server that has logic evaluating when it needs to scale up or scale down the back end instances of a given web service. 我有一台具有逻辑评估功能的服务器,它在何时需要放大或缩小给定Web服务的后端实例。
The trouble is I am unsure as of how exactly I am to programmatically send commands to my EC2 console instructing it to suspend or activate one of the back up services. 问题是我不确定如何以编程方式向我的EC2控制台发送命令以指示其挂起或激活备份服务之一。

I am aware that I can simply have a backup scripted to start and stop at certain times,however ideally I want my web service instances to start/stop in response to certain events such as increased demand. 我知道我可以简单地编写一个脚本来在特定时间启动和停止备份,但是理想情况下,我希望我的Web服务实例可以启动/停止以响应某些事件(例如需求增加)。

As I mentioned in the comment I suggest you take a look at autoscaling -- it sounds perfect for your use-case. 正如我在评论中提到的,我建议您看一下自动缩放 -听起来很适合您的用例。 Scaling up in response to increased demand and scaling down when idle is exactly what it was designed for. 扩大规模以响应不断增长的需求,并在闲置时缩小规模,这正是其初衷。

You can use the API to spawn and terminate instances if needed though: http://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html http://docs.aws.amazon.com/cli/latest/reference/ec2/terminate-instances.html 不过,您可以根据需要使用API​​生成和终止实例: http : //docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html http://docs.aws.amazon.com /cli/latest/reference/ec2/terminate-instances.html

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

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