-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudformation.yml
72 lines (65 loc) · 2.08 KB
/
cloudformation.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
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
AWSTemplateFormatVersion: "2010-09-09"
Description: A custom resource evaluating inline Node.js code directly inside your Cloudformation templates.
# Parameters exposed by this template.
Parameters:
# The lambda timeout value to apply to the custom resource function.
Timeout:
Type: Number
Default: 300
Description: The lambda timeout value to apply to the custom resource function.
MinValue: 1
# The amount of memory to allocate to the AWS Lambda function.
MemorySize:
Type: Number
Default: 128
Description: The lambda memory value to apply to the custom resource function.
MinValue: 128
MaxValue: 3008
# Parameters exposed by this template.
Resources:
# The custom resource lambda function definition.
EvaluationResourceFunction:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Role: !GetAtt EvaluationRole.Arn
Code: ./lambda/
Runtime: nodejs20.x
Timeout: !Ref Timeout
MemorySize: !Ref MemorySize
Environment:
Variables:
TIMEOUT: !Ref Timeout
# The IAM role to associate with the custom resurce lambda function.
EvaluationRole:
Type: AWS::IAM::Role
Properties:
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
# The outputs to be generated by this template.
Outputs:
Name:
Description: Cloudformation meta resource stack name
Value: !Ref AWS::StackName
Export:
Name: !Sub ${AWS::StackName}-Name
EvaluationResourceFunctionArn:
Description: The meta lambda function ARN.
Value: !GetAtt EvaluationResourceFunction.Arn
Export:
Name: !Sub ${AWS::StackName}-MetaFunctionArn
EvaluationRole:
Value: !Ref EvaluationRole
Export:
Name: !Sub ${AWS::StackName}-Role
EvaluationRoleArn:
Value: !GetAtt EvaluationRole.Arn
Export:
Name: !Sub ${AWS::StackName}-RoleArn