-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
63 lines (57 loc) · 1.58 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
rules-engine-to-lambda
Sample SAM Template for rules-engine-to-lambda
Globals:
Function:
Timeout: 60
Tracing: Active
Resources:
RulesHandlingFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: app/
Handler: app.lambdaHandler
Runtime: nodejs14.x
Architectures:
- x86_64
Tracing: Active
Environment:
Variables:
POWERTOOLS_SERVICE_NAME: RulesToLambdaService
POWERTOOLS_METRICS_NAMESPACE: rules-engine-to-lambda
LOG_LEVEL: INFO
EventInvokeConfig:
DestinationConfig:
OnFailure:
Type: SQS
Destination: !GetAtt FailedRequestsQueue.Arn
MaximumEventAgeInSeconds: 60
MaximumRetryAttempts: 2
Events:
IoTLambda:
Type: IoTRule
Properties:
AwsIotSqlVersion: 2016-03-23
Sql: SELECT * FROM 'device/+/from-device'
Metadata:
BuildMethod: esbuild
BuildProperties:
Minify: true
Target: "es2020"
EntryPoints:
- app.ts
FailedRequestsQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: "FailedRequestsQueue"
VisibilityTimeout: 300
KmsMasterKeyId: alias/aws/sqs
Outputs:
RulesHandlingFunction:
Description: "RulesHandlingFunction ARN"
Value: !GetAtt RulesHandlingFunction.Arn
RulesHandlingFunctionIamRole:
Description: "Implicit IAM Role for RulesHandlingFunction"
Value: !GetAtt RulesHandlingFunction.Arn