-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
103 lines (101 loc) · 4.22 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
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
# https://github.com/awslabs/serverless-application-model/blob/develop/versions/2016-10-31.md
# Indentation needs to be set with spaces, because YAML...
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: API endpoint for user achievements
Globals:
Function:
Environment:
Variables:
SQS_URL: !Ref SaveAchievementsQueue
Resources:
SaveAchievementsQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: deferred-save-achievements-queue
VisibilityTimeout: 601
Tags:
- Key: queue-name
Value: deferred-save-achievements-queue
RetrieveAchievementsFunction2:
Type: AWS::Serverless::Function
Properties:
Handler: retrieve-achievements.default
Runtime: nodejs18.x
CodeUri: ./dist/retrieve-achievements
Timeout: 29
MemorySize: 128
VpcConfig:
SecurityGroupIds:
- sg-eccd2691
SubnetIds:
- subnet-894624ec # Only the private subnet
# Layers:
# - !Sub "arn:aws:lambda:${AWS::Region}:580247275435:layer:LambdaInsightsExtension:14"
Policies:
- AWSLambdaVPCAccessExecutionRole
- AmazonSESFullAccess
- AmazonSQSFullAccess
- SecretsManagerReadWrite
- arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy
# For VPC
- AWSLambdaENIManagementAccess
- arn:aws:iam::478062583808:policy/CloudWatchPolicyForLambda # See https://stackoverflow.com/questions/51166504/disable-cloudwatch-to-monitor-logs-for-lambda-function
Tags:
LambdaName: api-retrieve-achievements-2
AutoPublishAlias: live
FunctionUrlConfig:
AuthType: NONE
StartSaveAchievementsFunction2:
Type: AWS::Serverless::Function
Properties:
Handler: start-save-achievements.default
Runtime: nodejs18.x
CodeUri: ./dist/start-save-achievements
Timeout: 3
MemorySize: 128
Policies:
- AWSLambdaVPCAccessExecutionRole
- AmazonSESFullAccess
- AmazonSQSFullAccess
- SecretsManagerReadWrite
- arn:aws:iam::478062583808:policy/CloudWatchPolicyForLambda # See https://stackoverflow.com/questions/51166504/disable-cloudwatch-to-monitor-logs-for-lambda-function
Tags:
LambdaName: api-start-save-achievements-2
AutoPublishAlias: live
FunctionUrlConfig:
AuthType: NONE
ProcessSaveAchievementsFunction:
Type: AWS::Serverless::Function
Properties:
Handler: process-save-achievements.default
Runtime: nodejs18.x
CodeUri: ./dist/process-save-achievements
MemorySize: 128
ReservedConcurrentExecutions: 1
VpcConfig:
SecurityGroupIds:
- sg-eccd2691
SubnetIds:
- subnet-894624ec # Only the private subnet
# Layers:
# - !Sub "arn:aws:lambda:${AWS::Region}:580247275435:layer:LambdaInsightsExtension:14"
Policies:
- AWSLambdaVPCAccessExecutionRole
- SecretsManagerReadWrite
- AmazonSESFullAccess
- AmazonSQSFullAccess
- arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy
# For VPC
- AWSLambdaENIManagementAccess
# - arn:aws:iam::478062583808:policy/CloudWatchPolicyForLambda # See https://stackoverflow.com/questions/51166504/disable-cloudwatch-to-monitor-logs-for-lambda-function
Tags:
LambdaName: process-save-achievements
Timeout: 60
Events:
SQSEvent:
Type: SQS
Properties:
Queue: !GetAtt SaveAchievementsQueue.Arn
BatchSize: 10
MaximumBatchingWindowInSeconds: 60