-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.yaml
47 lines (44 loc) · 1.26 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
lambdaFunctionName:
Type: "String"
Default: "smush-py"
Resources:
lambdaFunction:
Type: "AWS::Lambda::Function"
Properties:
Code:
ZipFile: |
%%SMUSH_FUNCTION%%
Description: "Smushed Python function"
FunctionName: !Ref "lambdaFunctionName"
Handler: "index.handler"
MemorySize: 128
ReservedConcurrentExecutions: 1
Role: !GetAtt "lambdaIAMRole.Arn"
Runtime: "python2.7"
Timeout: 2
lambdaIAMRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Action:
- "sts:AssumeRole"
Effect: "Allow"
Principal:
Service:
- "lambda.amazonaws.com"
Policies:
- PolicyDocument:
Version: "2012-10-17"
Statement:
- Action:
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
Effect: "Allow"
Resource:
- !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/${lambdaFunctionName}:*"
PolicyName: "lambda"