Skip to content

Instantly share code, notes, and snippets.

@cangoektas
Created October 6, 2017 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cangoektas/71e4b3f3f3e16677efb2df6e803d0c79 to your computer and use it in GitHub Desktop.
Save cangoektas/71e4b3f3f3e16677efb2df6e803d0c79 to your computer and use it in GitHub Desktop.
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