This repository has been archived by the owner on Aug 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
145 lines (135 loc) · 3.98 KB
/
serverless.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
service: message-batch-profiling
frameworkVersion: ">=1.1.0 <2.0.0"
plugins:
- serverless-python-requirements
- serverless-iam-roles-per-function
provider:
name: aws
runtime: python3.6
region: eu-west-1
stackName: ${self:service}
tracing:
lambda: true
package:
exclude:
- .github/**
- resources/**
- requirements.txt
- README.md
functions:
BatchProfilerIndividual:
handler: src.batch_profiler_individual.entry_point
name: BatchProfilerIndividual
description: A lambda function to send messages individually
environment:
LOG_LEVEL: DEBUG
TARGET_QUEUE_NAME: ${self:provider.stackName}-TargetQueue
TARGET_STREAM_NAME: ${self:provider.stackName}-TargetKinesisStream
memorySize: 128
iamRoleStatementsName: ${self:provider.stackName}-BatchProfilerIndividual
iamRoleStatements:
- Effect: Allow
Sid: xray
Action:
- "xray:*"
Resource:
- "*"
- Effect: Allow
Sid: "TargetQueue"
Action:
- SQS:SendMessage
- SQS:GetQueueAttributes
- SQS:GetQueueUrl
- SQS:ListQueueTags
- SQS:ChangeMessageVisibility
Resource:
- { "Fn::GetAtt": ["TargetQueue", "Arn"] }
- Effect: Allow
Sid: "TargetStream"
Action:
- kinesis:PutRecord
Resource:
- { "Fn::GetAtt": ["TargetKinesisStream", "Arn"] }
BatchProfilerBatch:
handler: src.batch_profiler_batch.entry_point
name: BatchProfilerBatch
description: A lambda function to send messages in batches
environment:
LOG_LEVEL: DEBUG
TARGET_QUEUE_NAME: ${self:provider.stackName}-TargetQueue
TARGET_STREAM_NAME: ${self:provider.stackName}-TargetKinesisStream
memorySize: 128
iamRoleStatementsName: ${self:provider.stackName}-BatchProfilerBatch
iamRoleStatements:
- Effect: Allow
Sid: xray
Action:
- "xray:*"
Resource:
- "*"
- Effect: Allow
Sid: "TargetQueue"
Action:
- SQS:SendMessage
- SQS:GetQueueAttributes
- SQS:GetQueueUrl
- SQS:ListQueueTags
- SQS:ChangeMessageVisibility
Resource:
- { "Fn::GetAtt": ["TargetQueue", "Arn"] }
- Effect: Allow
Sid: "TargetStream"
Action:
- kinesis:PutRecords
Resource:
- { "Fn::GetAtt": ["TargetKinesisStream", "Arn"] }
BatchProfilerBoto3BatchUtils:
handler: src.batch_profiler_boto3_batch_utils.entry_point
name: BatchProfilerBoto3BatchUtils
description: A lambda function to send messages using boto3-batch-utils
environment:
LOG_LEVEL: DEBUG
TARGET_QUEUE_NAME: ${self:provider.stackName}-TargetQueue
TARGET_STREAM_NAME: ${self:provider.stackName}-TargetKinesisStream
memorySize: 128
iamRoleStatementsName: ${self:provider.stackName}-BatchProfilerBoto3BatchUtils
iamRoleStatements:
- Effect: Allow
Sid: xray
Action:
- "xray:*"
Resource:
- "*"
- Effect: Allow
Sid: "TargetQueue"
Action:
- SQS:SendMessage
- SQS:GetQueueAttributes
- SQS:GetQueueUrl
- SQS:ListQueueTags
- SQS:ChangeMessageVisibility
Resource:
- { "Fn::GetAtt": ["TargetQueue", "Arn"] }
- Effect: Allow
Sid: "TargetStream"
Action:
- kinesis:PutRecord
- kinesis:PutRecords
Resource:
- { "Fn::GetAtt": ["TargetKinesisStream", "Arn"] }
resources:
Resources:
TargetQueue:
Type: AWS::SQS::Queue
Properties:
VisibilityTimeout: 30
DelaySeconds: 0
MaximumMessageSize: 262144
MessageRetentionPeriod: 7200
QueueName: ${self:provider.stackName}-TargetQueue
TargetKinesisStream:
Type: AWS::Kinesis::Stream
Properties:
Name: ${self:provider.stackName}-TargetKinesisStream
RetentionPeriodHours: 24
ShardCount: 1