Instantly share code, notes, and snippets.

Embed
What would you like to do?
AWSTemplateFormatVersion: '2010-09-09'
Resources:
LambdaBasicExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Hello:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket: unique-bucket-name-1234
S3Key: name-of-your-deployment-package.zip
Handler: handler.hello
Role:
Fn::GetAtt:
- LambdaBasicExecutionRole
- Arn
Runtime: nodejs6.10
EventRule:
Type: AWS::Events::Rule
Properties:
ScheduleExpression: cron(*/5 * * * ? *)
State: ENABLED
Targets:
- Arn:
Fn::GetAtt:
- Hello
- Arn
Id: HelloTarget
PermissionForEventsToInvokeLambda:
Type: AWS::Lambda::Permission
Properties:
FunctionName:
Ref: Hello
Action: lambda:InvokeFunction
Principal: events.amazonaws.com
SourceArn:
Fn::GetAtt:
- EventRule
- Arn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment