-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
101 lines (99 loc) · 4.15 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
# 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 packs
Globals:
Function:
Environment:
Variables:
SQS_URL: !Ref SavePacksQueue
Resources:
SavePacksQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: deferred-save-packs-queue
VisibilityTimeout: 601
RetrievePacksFunction2:
Type: AWS::Serverless::Function
Properties:
Handler: retrieve-packs.default
Runtime: nodejs18.x
CodeUri: ./dist/retrieve-packs
Timeout: 29
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-packs-2
AutoPublishAlias: live
FunctionUrlConfig:
AuthType: NONE
StartSavePacksFunction2:
Type: AWS::Serverless::Function
Properties:
Handler: start-save-packs.default
Runtime: nodejs18.x
CodeUri: ./dist/start-save-packs
Timeout: 5
# Layers:
# - !Sub "arn:aws:lambda:${AWS::Region}:580247275435:layer:LambdaInsightsExtension:14"
Policies:
- AWSLambdaVPCAccessExecutionRole
- AmazonSESFullAccess
- AmazonSQSFullAccess
- SecretsManagerReadWrite
- arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy
- 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-packs-2
AutoPublishAlias: live
FunctionUrlConfig:
AuthType: NONE
ProcessSavePacksFunction:
Type: AWS::Serverless::Function
Properties:
Handler: process-save-packs.default
Runtime: nodejs18.x
CodeUri: ./dist/process-save-packs
MemorySize: 128
ReservedConcurrentExecutions: 5
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-packs
Timeout: 60
Events:
SQSEvent:
Type: SQS
Properties:
Queue: !GetAtt SavePacksQueue.Arn
BatchSize: 60
MaximumBatchingWindowInSeconds: 60