-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.yaml
57 lines (52 loc) · 1.69 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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
sam-browser
SAM Template for sam-browser Lambda Application
Resources:
ChromePuppeteerLayer:
Type: AWS::Serverless::LayerVersion
Properties:
Description: Serverless Chrome/Puppeteer Layer
ContentUri: layers/puppeteer/
CompatibleRuntimes:
- nodejs14.x
Metadata:
BuildMethod: nodejs14.x
SendMetricsFunction:
Type: AWS::Serverless::Function
Properties:
Description: Send Metrics for Website Finder Results
CodeUri: functions/send-metrics/
Handler: app.lambdaHandler
Timeout: 5
MemorySize: 256
Runtime: nodejs14.x
WebsiteFinderFunction:
Type: AWS::Serverless::Function
Properties:
Description: Find Web Page DOM Element Function
CodeUri: functions/website-finder/
Handler: app.lambdaHandler
Timeout: 30
MemorySize: 2048 # Chrome will require higher memory
Runtime: nodejs14.x
Layers:
- !Ref ChromePuppeteerLayer # Attach Our Chrome Layer
TrackUptimeMachine:
Type: AWS::Serverless::StateMachine
Properties:
DefinitionUri: statemachines/track-uptime.asl.json
Policies:
- LambdaInvokePolicy:
FunctionName: !Ref SendMetricsFunction
- LambdaInvokePolicy:
FunctionName: !Ref WebsiteFinderFunction
Events:
CheckSchedule1:
Type: Schedule
Properties:
Description: Check Website Every Minute
Enabled: True
Schedule: "rate(1 minute)" # choose the frequency
Input: '{"url": "https://hackerrdave.com", "querySelector": "#___gatsby", "inverse": false}'