[英]AWS CloudWatch Alarms to multiple EC2 instances
I'm wanting to apply a CloudWatch alarm to stop instances which aren't being used in our pre-production environment. 我想应用CloudWatch警报来停止未在我们的预生产环境中使用的实例。 We often have instances being spun up, used and then left turned on which is really starting to cost us a fair amount of money.
我们经常会出现旋转,使用然后再打开的情况,这真的开始花费我们相当多的钱。
CloudWatch alarms have a handy feature whereby we can stop based on some metrics - this is awesome and what I'd like to use to constantly keep an eye on the servers with but let it tidy up the instances for me. CloudWatch警报有一个方便的功能,我们可以根据一些指标停止 - 这是非常棒的,我想用它来不断关注服务器,但让它为我整理实例。
The problem with this is that it appears that the CloudWatch alarms need to be created individually against each instance. 这样做的问题是,似乎需要针对每个实例单独创建CloudWatch警报。 Is there a way in which I can create one alarm which would share values across all current and future instances which will be started?
有没有办法可以创建一个警报,它将在所有当前和未来的实例中共享值?
ETA - Alternatively, tell me that these options are better than CloudWatch and I'll be happy at that. ETA - 或者,告诉我这些选项比CloudWatch更好,我会很高兴。
AWS EC2 stop all through PowerShell/CMD tools AWS EC2通过PowerShell / CMD工具停止所有操作
Add a startup script that creates the CloudWatch alarm to the base image you use to generate your VMs. 将创建CloudWatch警报的启动脚本添加到用于生成VM的基本映像。
http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CLIReference.html http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CLIReference.html
I don't believe this is possible - CloudWatch seems designed to be 'very manual' or 'very automated'. 我不相信这是可能的 - CloudWatch似乎设计为“非常手动”或“非常自动化”。 ie You can't setup one alarm which would go off if any one instance is idle, you have to setup individual alarms for each instance.
即,如果任何一个实例处于空闲状态,您无法设置一个警报,您必须为每个实例设置单独的警报。
A couple of possible solutions, which are probably not what you want to hear: 一些可能的解决方案,可能不是您想听到的:
I think what you are actually looking for would be auto-scaling: 我认为你真正想要的是自动缩放:
https://aws.amazon.com/documentation/autoscaling/ https://aws.amazon.com/documentation/autoscaling/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.