-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
43 lines (38 loc) · 997 Bytes
/
template.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
AWSTemplateFormatVersion: 2010-09-09
Transform:
- AWS::Serverless-2016-10-31
Description: "Collect Nucleus telemetry data as CloudWatch metrics."
Parameters:
MqttTopic:
Type: String
Description: "MQTT Topic name"
CoreDevice:
Type: String
Description: "Greengrass Core Device name"
Default: ""
MetricNamespace:
Type: String
Description: "CloudWatch metric namespace name"
Default: "Greengrass"
Globals:
Function:
Runtime: "nodejs14.x"
Timeout: 6
CodeUri: src/
Resources:
CollectFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Ref AWS::StackName
Handler: collect.handler
Environment:
Variables:
METRIC_NAMESPACE: !Ref MetricNamespace
CORE_DEVICE: !Ref CoreDevice
Policies:
- CloudWatchPutMetricPolicy: {}
Events:
NucleusTelemetryEvent:
Type: IoTRule
Properties:
Sql: !Sub "SELECT * FROM '${MqttTopic}'"