-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-resource-demo.yml
47 lines (39 loc) · 1.29 KB
/
custom-resource-demo.yml
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
Description: >
Simple custom resource demo
Parameters:
InputMessage:
Type: String
Description: An input to the custom resource
Default: Hello function!
RoleForLambda:
Description: ARN of the role you created
Type: String
Resources:
MyCustomResourceFunction:
Type: AWS::Lambda::Function
Properties:
Code:
ZipFile: |
var response = require('cfn-response');
var aws = require("aws-sdk");
exports.handler = function(event, context) {
var input = event.ResourceProperties.InputParameter;
var responseData = {msg: "hello world!", msg2: input + " --received from caller"};
response.send(event, context, response.SUCCESS, responseData);
};
Handler: index.handler
Timeout: 30
Runtime: nodejs14.x
Role: !Ref RoleForLambda
MyCustomResourceCallout:
Type: Custom::LambdaCallout
Properties:
ServiceToken: !GetAtt MyCustomResourceFunction.Arn
InputParameter: !Ref InputMessage
Outputs:
OutputFromFunction:
Description: Output from the custom function
Value: !GetAtt MyCustomResourceCallout.msg
ModifiedInputReturned:
Description: Pipe out the input so we know we got it
Value: !GetAtt MyCustomResourceCallout.msg2