簡體   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