Skip to content

Commit acdce9a

Browse files
committed
update examples sam template
1 parent 5cc2d4a commit acdce9a

File tree

3 files changed

+46
-13
lines changed

3 files changed

+46
-13
lines changed

examples/BatchProcessing/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ You will need the following for local testing.
3333
To build and deploy your application for the first time, run the following in your shell. Make sure the `template.yaml` file is in your current directory:
3434

3535
```bash
36-
cd deploy/sqs
3736
sam build
3837
sam deploy --guided
3938
```

examples/BatchProcessing/template-docker.yaml

Whitespace-only changes.

examples/BatchProcessing/template.yaml

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Resources:
111111
FunctionResponseTypes:
112112
- ReportBatchItemFailures
113113

114+
# --------------
115+
# Batch Processing for DynamoDb
116+
114117
SampleDynamoDBTable:
115118
Type: AWS::DynamoDB::Table
116119
Properties:
@@ -125,8 +128,38 @@ Resources:
125128
StreamSpecification:
126129
StreamViewType: NEW_AND_OLD_IMAGES
127130

131+
DemoDynamoDBStreamProcessorFunction:
132+
Type: AWS::Serverless::Function
133+
Properties:
134+
FunctionName: powertools-dotnet-sample-batch-processor-dynamodb
135+
CodeUri: ./src/HelloWorld/
136+
Handler: HelloWorld::HelloWorld.Function::DynamoDbStreamHandlerUsingAttribute
137+
Policies: AWSLambdaDynamoDBExecutionRole
138+
Events:
139+
Stream:
140+
Type: DynamoDB
141+
Properties:
142+
Stream: !GetAtt SampleDynamoDBTable.StreamArn
143+
BatchSize: 100
144+
StartingPosition: TRIM_HORIZON
145+
FunctionResponseTypes:
146+
- ReportBatchItemFailures
147+
128148
# --------------
129149
# Batch Processing for Kinesis Data Streams
150+
151+
DemoKinesisStream:
152+
Type: AWS::Kinesis::Stream
153+
Properties:
154+
ShardCount: 1
155+
156+
StreamConsumer:
157+
Type: "AWS::Kinesis::StreamConsumer"
158+
Properties:
159+
StreamARN: !GetAtt DemoKinesisStream.Arn
160+
ConsumerName: KinesisBatchHandlerConsumer
161+
162+
130163
SampleKinesisEventBatchProcessorFunction:
131164
Type: AWS::Serverless::Function
132165
Properties:
@@ -135,15 +168,13 @@ Resources:
135168
CodeUri: ./src/HelloWorld/
136169
Handler: HelloWorld::HelloWorld.Function::KinesisEventHandlerUsingAttribute
137170
MemorySize: 256
138-
# ReservedConcurrentExecutions: 1
139-
Policies:
140-
- AWSLambdaBasicExecutionRole
141-
- KinesisStreamReadPolicy:
142-
StreamName: !Ref SampleKinesisDataStream
143-
Environment:
144-
Variables:
145-
POWERTOOLS_BATCH_PROCESSING_ERROR_HANDLING_POLICY: DeriveFromEvent
146-
POWERTOOLS_BATCH_PROCESSING_MAX_DEGREE_OF_PARALLELISM: 1
171+
Events:
172+
Kinesis:
173+
Type: Kinesis
174+
Properties:
175+
Stream: !GetAtt StreamConsumer.ConsumerARN
176+
StartingPosition: LATEST
177+
BatchSize: 2
147178

148179
Outputs:
149180
DemoSqsQueue:
@@ -155,6 +186,9 @@ Outputs:
155186
SampleSqsBatchProcessorFunction:
156187
Description: "SQS Batch Handler - Lambda Function ARN"
157188
Value: !GetAtt SampleSqsBatchProcessorFunction.Arn
158-
SampleSqsBatchProcessorFunctionRole:
159-
Description: "Implicit IAM Role created for SQS Lambda Function ARN"
160-
Value: !GetAtt SampleSqsBatchProcessorFunctionRole.Arn
189+
DemoKinesisQueue:
190+
Description: "ARN for Kinesis Stream"
191+
Value: !GetAtt DemoKinesisStream.Arn
192+
DemoSQSConsumerFunction:
193+
Description: "SQS Batch Handler - Lambda Function ARN"
194+
Value: !GetAtt SampleKinesisEventBatchProcessorFunction.Arn

0 commit comments

Comments
 (0)