Skip to content

Instantly share code, notes, and snippets.

@jdaarevalo
Created April 21, 2023 18:55
Show Gist options
  • Save jdaarevalo/be461237aa05a26521f7a9587cb218c8 to your computer and use it in GitHub Desktop.
Save jdaarevalo/be461237aa05a26521f7a9587cb218c8 to your computer and use it in GitHub Desktop.
AggregatorFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/
Handler: aggregator_lambda.lambda_handler
Runtime: python3.9
Architectures:
- x86_64
Policies:
- AmazonDynamoDBFullAccess
Environment:
Variables:
SG_AGGREGATE_TABLE_NAME: !Ref SGAggregateTableName
Layers:
- !Sub 'arn:aws:lambda:${RegionName}:017000801446:layer:AWSLambdaPowertoolsPythonV2:16'
EventSourceSGProcessesDBTableStream:
Type: AWS::Lambda::EventSourceMapping
Properties:
BatchSize: 100
MaximumBatchingWindowInSeconds: 30
Enabled: True
FilterCriteria:
Filters:
- Pattern: '{"eventName":["MODIFY"]}'
EventSourceArn: !GetAtt SGProcessesDBTable.StreamArn
FunctionName: !GetAtt AggregatorFunction.Arn
StartingPosition: LATEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment