I am unable to control the ENABLED/DISABLED state of a CloudWatch Rule that targets a Lambda function via the documented methods as described here: https://serverless.com/framework/docs/providers/aws/events/schedule/
I created this simple serverless.yml to demonstrate. It should create a Lambda that has a cron based CloudWatch Rule configured in a DISABLED state. However, the corresponding CloudFormation template is not generated correctly.
Is there anyway I am doing this incorrectly? Or a different approach I could take?
service: sls-schedule-control-test # NOTE: update this with your service name
provider:
name: aws
runtime: python3.7
functions:
hello:
handler: handler.hello
events:
- schedule: cron(10 21 * * ? *)
enabled: false
CFT Rule Section - Expected output:
"HelloEventsRuleSchedule1": {
"Type": "AWS::Events::Rule",
"Properties": {
"ScheduleExpression": "cron(10 21 * * ? *)",
"State": "DISABLED",
"Targets": [
{
"Arn": {
"Fn::GetAtt": [
"HelloLambdaFunction",
"Arn"
]
},
"Id": "helloSchedule"
}
]
}
},
CFT Rule Section - Actual (incorrect) output:
"HelloEventsRuleSchedule1": {
"Type": "AWS::Events::Rule",
"Properties": {
"ScheduleExpression": "cron(10 21 * * ? *)",
"State": "ENABLED",
"Targets": [
{
"Arn": {
"Fn::GetAtt": [
"HelloLambdaFunction",
"Arn"
]
},
"Id": "helloSchedule"
}
]
}
},
Output from ‘sls print’ command:
sls print
service: sls-schedule-control-test
provider:
name: aws
runtime: python3.7
functions:
hello:
handler: handler.hello
events:
- schedule: cron(10 21 * * ? *)
enabled: false