-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathtemplate.yml
83 lines (75 loc) · 2.37 KB
/
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
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Kinesis batch processing demo
Globals:
Function:
Timeout: 20
Runtime: java11
MemorySize: 512
Tracing: Active
Environment:
Variables:
POWERTOOLS_LOG_LEVEL: INFO
POWERTOOLS_LOGGER_SAMPLE_RATE: 1.0
POWERTOOLS_LOGGER_LOG_EVENT: true
Resources:
DemoKinesisStream:
Type: AWS::Kinesis::Stream
Properties:
ShardCount: 1
StreamConsumer:
Type: "AWS::Kinesis::StreamConsumer"
Properties:
StreamARN: !GetAtt DemoKinesisStream.Arn
ConsumerName: KinesisBatchHandlerConsumer
DemoKinesisSenderFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ../..
Handler: org.demo.batch.kinesis.KinesisBatchSender::handleRequest
Environment:
Variables:
POWERTOOLS_SERVICE_NAME: kinesis-batch-demo
STREAM_NAME: !Ref DemoKinesisStream
Policies:
- Statement:
- Sid: WriteToKinesis
Effect: Allow
Action:
- kinesis:PutRecords
- kinesis:DescribeStream
Resource: !GetAtt DemoKinesisStream.Arn
Events:
CWSchedule:
Type: Schedule
Properties:
Schedule: 'rate(5 minutes)'
Name: !Join [ "-", [ "message-producer-schedule", !Select [ 0, !Split [ -, !Select [ 2, !Split [ /, !Ref AWS::StackId ] ] ] ] ] ]
Description: Produce message to Kinesis via a Lambda function
Enabled: true
DemoKinesisConsumerFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ../..
Handler: org.demo.batch.kinesis.KinesisBatchHandler::handleRequest
Environment:
Variables:
POWERTOOLS_SERVICE_NAME: kinesis-demo
Events:
Kinesis:
Type: Kinesis
Properties:
Stream: !GetAtt StreamConsumer.ConsumerARN
StartingPosition: LATEST
BatchSize: 2
Outputs:
DemoKinesisQueue:
Description: "ARN for Kinesis Stream"
Value: !GetAtt DemoKinesisStream.Arn
DemoKinesisSenderFunction:
Description: "Kinesis Batch Sender - Lambda Function ARN"
Value: !GetAtt DemoKinesisSenderFunction.Arn
DemoSQSConsumerFunction:
Description: "SQS Batch Handler - Lambda Function ARN"
Value: !GetAtt DemoKinesisConsumerFunction.Arn