Files
saladeaula.digital/streams-events/template.yaml
2025-12-20 22:23:35 -03:00

164 lines
5.9 KiB
YAML

AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
CodeUri: app/
Runtime: python3.13
Architectures:
- x86_64
Layers:
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:103
Environment:
Variables:
LOG_LEVEL: DEBUG
TZ: America/Sao_Paulo
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
POWERTOOLS_LOGGER_LOG_EVENT: true
MEILISEARCH_HOST: https://meili.saladeaula.digital
MEILISEARCH_API_KEY: '{{resolve:ssm:/saladeaula/meili_api_key}}'
POSTGRES_DB: saladeaula.digital
POSTGRES_HOST: sp-node01.saladeaula.digital
POSTGRES_PORT: 5432
POSTGRES_USER: '{{resolve:ssm:/saladeaula/postgres_user}}'
POSTGRES_PASSWORD: '{{resolve:ssm:/saladeaula/postgres_password}}'
Resources:
MeilisearchLog:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 30
EventBusLog:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 30
PostgresLog:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 30
EventIndexDocsIntoMeiliFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.index_docs_into_meili.lambda_handler
LoggingConfig:
LogGroup: !Ref MeilisearchLog
Events:
Enrollments:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-enrollments/stream/2023-08-22T22:56:55.612
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
Users:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-users_d2o3r5gmm4it7j/stream/2022-06-12T21:33:25.634
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
Orders:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-orders/stream/2023-09-15T18:58:50.395
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
Courses:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/saladeaula_courses/stream/2025-03-12T20:42:46.706
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
EventDocsIntoEventBusFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.docs_into_eventbus.lambda_handler
LoggingConfig:
LogGroup: !Ref EventBusLog
Policies:
- EventBridgePutEventsPolicy:
EventBusName: default
Events:
Users:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-users_d2o3r5gmm4it7j/stream/2022-06-12T21:33:25.634
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Enrollments:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-enrollments/stream/2023-08-22T22:56:55.612
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Orders:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-orders/stream/2023-09-15T18:58:50.395
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Courses:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/saladeaula_courses/stream/2025-03-12T20:42:46.706
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
EventReplicateIntoPostgresFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.replicate_into_postgres.lambda_handler
LoggingConfig:
LogGroup: !Ref PostgresLog
Events:
Users:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-users_d2o3r5gmm4it7j/stream/2022-06-12T21:33:25.634
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Enrollments:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-enrollments/stream/2023-08-22T22:56:55.612
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Orders:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-orders/stream/2023-09-15T18:58:50.395
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Courses:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/saladeaula_courses/stream/2025-03-12T20:42:46.706
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25