我使用cloudwatch预定事件在特定时间间隔后触发我的lambda函数 . 我想使用 Cloud 形成模板在cloudwatch中添加此规则 . 我已经浏览了cloudformation模板文档,但我无法找到使用 Cloud 形成模板配置事件的方法 . 任何人都可以建议如何使用 Cloud 形成模板实现它 .
我正在使用下面的模板 .
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Provision environment specific",
"Resources": {
"lambdaScheduler": {
"Type": "AWS::CloudWatch::Event",
"Properties": {
"detail-type": "Scheduled Event",
"source": "aws.events",
"name": "TEST_EVENT_10_MINS_RULE",
"schedule-expression": "rate(5 minutes)"
}
}
}
}
当我使用aws cli验证它时,我收到 A client error (ValidationError) occurred when calling the ValidateTemplate operation: Template format error: Unrecognized resource type: AWS::CloudWatch::Event
错误消息 .
2 回答
现在添加CloudWatch事件规则和日程表,请参阅https://aws.amazon.com/about-aws/whats-new/2016/04/amazon-cloudwatch-events-now-supported-in-aws-cloudformation-templates/
我非常确定CloudWatch Event尚未通过CloudFormation API公开 . AWS中的新功能与CloudFormation团队实施/公开的功能之间通常存在一些延迟 .
以下是CloudFormation当前可用的资源列表 . http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
可以看出,Cloudwatch命名空间中只有一个资源 .