繁体   English   中英

如何使用 cloudformation 模板创建 cloudwatch 事件?

[英]How to create cloudwatch event using cloudformation template?

我正在使用 cloudwatch 计划事件在特定时间间隔后触发我的 lambda 函数。 我想使用 cloud-formation 模板在 cloudwatch 中添加此规则。 我已经阅读了 cloudformation 模板文档,但我无法找到使用 cloudformation 模板配置事件的方法。 任何人都可以建议如何使用云形成模板来实现它。

我正在使用以下模板。

{
  "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)"
      }
    }
  }
}

A client error (ValidationError) occurred when calling the ValidateTemplate operation: Template format error: Unrecognized resource type: AWS::CloudWatch::Event错误消息,当我使用 aws cli 验证它时。

我很确定 CloudWatch 事件尚未通过 CloudFormation API 公开。 AWS 中的新功能与 CloudFormation 团队实施/公开的功能之间通常存在一些滞后。

这是当前通过 CloudFormation 可用的资源列表。 http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html

如您所见,Cloudwatch 命名空间中只有一种资源。

您是否尝试过在 CloudFormation 设计器中布置您的设计? 它只为每个元素创建存根代码,但它验证整体设计。 然后您必须将大纲代码传输到编辑器才能完成实际工作,但它应该避免您引用的错误。

暂无
暂无

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

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