-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathlambda.yaml
51 lines (51 loc) · 1.62 KB
/
lambda.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
48
49
50
51
AWSTemplateFormatVersion: '2010-09-09'
Resources:
LambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
-
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
Path: /
Policies:
-
PolicyName: CloudwatchLogs
PolicyDocument:
Version: 2012-10-17
Statement:
-
Effect: Allow
Action:
- logs:CreateLogGroup
Resource:
- !Sub "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:*"
-
Effect: Allow
Action:
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- !Sub "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*"
LambdaUDFFunction:
Type: "AWS::Lambda::Function"
Properties:
FunctionName: f-upper-javascript-varchar
Role: !GetAtt 'LambdaRole.Arn'
Timeout: 300
Code:
ZipFile: |
exports.handler = async (event) => {
console.log('Received event:', JSON.stringify(event, null, 2));
var res = event.arguments.map((x) => x[0].toUpperCase());
var ret_json = JSON.stringify({"results": res});
return ret_json
};
Handler: index.handler
Runtime: nodejs14.x