-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
61 lines (61 loc) · 1.55 KB
/
serverless.yml
File metadata and controls
61 lines (61 loc) · 1.55 KB
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
service: lambda-scheduler
plugins:
- serverless-step-functions
provider:
name: aws
profile: lambda
runtime: ruby2.7
memorySize: 128
region: <region>
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: "arn:aws:lambda:<region>:<account>:function:*"
- Effect: Allow
Action:
- states:CreateStateMachine
Resource: "arn:aws:states:<region>:<account>:stateMachine:*"
environment:
STAGE: ${self:provider.stage}
REGION: <region>
functions:
ping:
handler: scheduler.ping
iterate:
handler: scheduler.iterate
stepFunctions:
stateMachines:
ten_seconds:
events:
- schedule: cron(* * * * ? *)
definition:
Comment: Invoke Lambda every 10 seconds
StartAt: ConfigureCount
States:
ConfigureCount:
Type: Pass
Result:
index: 0
count: 6
ResultPath: "$.iterator"
Next: "Iterator"
Iterator:
Type: Task
Resource: arn:aws:lambda:<region>:<account>:function:lambda-scheduler-${self:provider.stage}-iterate
ResultPath: "$.iterator"
Next: IsCountReached
IsCountReached:
Type: Choice
Choices:
- Variable: "$.iterator.continue"
BooleanEquals: true
Next: Wait
Default: Done
Wait:
Type: Wait
Seconds: 10
Next: Iterator
Done:
Type: Pass
End: true