5

我正在使用cloudwatch計劃事件在特定時間間隔後觸發我的lambda函數。我想使用雲形成模板在Cloudwatch中添加此規則。我已經通過了cloudformation模板文檔,但我無法找到使用雲形成模板配置事件的方法。任何人都可以請建議如何使用雲形成模板來實現它。如何使用cloudformation模板創建cloudwatch事件?

我正在使用下面的模板。

{ 
    "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驗證。

回答