Skip to content

Instantly share code, notes, and snippets.

@deegloo deegloo/Schedule.yml
Last active Oct 16, 2018

Embed
What would you like to do?
Scheduling AWS Lambda execution using CloudWatch event rule
Description: >-
Schedule - the infrastructure.
AWSTemplateFormatVersion: 2010-09-09
Transform: "AWS::Serverless-2016-10-31"
Resources:
NotifierLambda:
Type: AWS::Serverless::Function
Properties:
FunctionName: 'notifier'
Handler: index.handler
CodeUri: 's3://deegloo-blog-post/schedule-notify-trigger/notifier-partial.zip'
Runtime: nodejs6.10
MemorySize: 1536
Timeout: 300
Environment:
Variables:
SOME_VARIABLE: 'some-value'
NotifierLambdaScheduledRule:
Type: AWS::Events::Rule
Properties:
Name: 'notifier-scheduled-rule'
Description: 'Triggers notifier lambda once per day'
ScheduleExpression: cron(0 7 ? * * *)
State: ENABLED
Targets:
-
Arn: !GetAtt NotifierLambda.Arn
Id: TargetFunctionV1
NotifierLambdaInvokePermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !Ref NotifierLambda
Action: lambda:InvokeFunction
Principal: events.amazonaws.com
SourceArn: !GetAtt NotifierLambdaScheduledRule.Arn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.