简体   繁体   English

使用CloudFormation将CloudWatch添加到堆栈中

[英]adding CloudWatch to a stack with CloudFormation

I am currently in charge of adding CloudWatch integration to an already made Cloud Formation stack. 我目前负责将CloudWatch集成添加到已完成的Cloud Formation堆栈中。

We create the stacks through CLI, but at the moment we add CloudWatch manually afterwards. 我们通过CLI创建堆栈,但此后我们随后手动添加CloudWatch。

What i need is to automatically activate CloudWatch for instances and monitor CPU, hdd and so on through the use of CloudFormation templates. 我需要的是通过使用CloudFormation模板自动为实例激活CloudWatch并监视CPU,HDD等。

Thanks in advance! 提前致谢!

My suggestion is that you don't add new CloudWatch items to the existing CloudFormation stack. 我的建议是,不要将新的CloudWatch项目添加到现有的CloudFormation堆栈中。 Instead, create a CF template with the appropriate metrics and deploy from this template for each instance you want to monitor. 而是使用适当的指标创建CF模板,并从该模板为要监视的每个实例进行部署。

From there, I suggest you create an AWS Lambda function that will receive an Instance Id as input and will deploy a CloudFormation stack against the instance. 从那里,我建议您创建一个AWS Lambda函数,该函数将接收实例ID作为输入,并将针对该实例部署CloudFormation堆栈。 You should enable CloudTrail on your account and create a Rule to match any RunInstances event on the account and trigger the Lambda function. 您应该在您的帐户上启用CloudTrail并创建一个规则以匹配该帐户上的任何RunInstances事件并触发Lambda函数。

Keep in mind the default limit for CloudFormation stacks is 200. You might need to request an increase depending on your use case. 请记住,CloudFormation堆栈的默认限制为200。根据您的用例,您可能需要请求增加。

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

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