-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yml
More file actions
107 lines (95 loc) · 2.61 KB
/
template.yml
File metadata and controls
107 lines (95 loc) · 2.61 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Custom Function example
Resources:
Fn1:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs12.x
CodeUri: ./cfn
Description: Custom function 1
Timeout: 90
Policies:
- AWSLambdaBasicExecutionRole
Environment:
Variables:
DEBUG: '*'
Cfn1:
Type: Custom::Cfn1
Properties:
ServiceToken: !GetAtt Fn1.Arn
Fn2:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs12.x
Description: Custom function 2
Timeout: 90
Policies:
- AWSLambdaBasicExecutionRole
InlineCode: |
const cfn_response = require('cfn-response');
exports.handler = (event, context) => {
try {
console.log('Event', event.ResponseURL, event.RequestType, event.StackId, event.RequestId, event.LogicalResourceId);
switch (event.RequestType) {
case 'Create':
console.log(`Creating was called`);
cfn_response.send(event, context, cfn_response.SUCCESS, {});
break;
case 'Update':
console.log(`Update was called`);
cfn_response.send(event, context, cfn_response.SUCCESS, {});
break;
case 'Delete':
console.log(`Delete was called`);
cfn_response.send(event, context, cfn_response.SUCCESS, {});
break;
default:
cfn_response.send(event, context, cfn_response.FAILED, {});
break;
}
} catch (err) {
console.error(err);
cfn_response.send(event, context, cfn_response.FAILED, {});
}
};
Cfn2:
Type: Custom::Cfn2
Properties:
ServiceToken: !GetAtt Fn2.Arn
Fn3:
Type: AWS::Serverless::Function
Properties:
Handler: index-async.handler
Runtime: nodejs12.x
CodeUri: ./cfn
Description: Custom function 3
Timeout: 90
Policies:
- AWSLambdaBasicExecutionRole
Environment:
Variables:
DEBUG: '*'
Cfn3:
Type: Custom::Cfn3
Properties:
ServiceToken: !GetAtt Fn3.Arn
Fn4:
Type: AWS::Serverless::Function
Properties:
Handler: index-es.handler
Runtime: nodejs14.x
CodeUri: ./cfn
Description: Custom function 4
Timeout: 90
Policies:
- AWSLambdaBasicExecutionRole
Environment:
Variables:
DEBUG: '*'
Cfn4:
Type: Custom::Cfn4
Properties:
ServiceToken: !GetAtt Fn4.Arn