Created
March 20, 2019 08:32
-
-
Save maatthc/867c646314fa567cbc0cad9886783545 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "An example lambda template to demonstrate persistent state between executions" | |
Resources: | |
LambdaExecutionRole: | |
Type: "AWS::IAM::Role" | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: lambda.amazonaws.com | |
Action: "sts:AssumeRole" | |
countExecutionLambda: | |
Type: "AWS::Lambda::Function" | |
Properties: | |
Handler: "index.handler" | |
Role: !GetAtt [ LambdaExecutionRole, Arn ] | |
Code: | |
ZipFile: | | |
let executionCounter = 0 | |
exports.handler = function(event, context) { | |
executionCounter++ | |
console.log(`Number of execution: ${executionCounter}`) | |
return 'okay' | |
} | |
Runtime: "nodejs8.10" | |
Timeout: "25" | |
MemorySize: 128 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment