add postgres

This commit is contained in:
2025-08-26 00:00:42 -03:00
parent 1326530991
commit e33eccebb9
43 changed files with 622 additions and 636 deletions

View File

@@ -8,15 +8,20 @@ Globals:
Architectures:
- x86_64
Layers:
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:94
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:96
Environment:
Variables:
LOG_LEVEL: INFO
LOG_LEVEL: DEBUG
TZ: America/Sao_Paulo
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
POWERTOOLS_LOGGER_LOG_EVENT: true
MEILISEARCH_HOST: https://meili.eduseg.com.br
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:
@@ -29,6 +34,11 @@ Resources:
Properties:
RetentionInDays: 90
EventPostgresLog:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 90
EventIndexDocsIntoMeiliFunction:
Type: AWS::Serverless::Function
Properties:
@@ -46,7 +56,6 @@ Resources:
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
Users:
Type: DynamoDB
Properties:
@@ -57,7 +66,6 @@ Resources:
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
Orders:
Type: DynamoDB
Properties:
@@ -68,7 +76,6 @@ Resources:
FilterCriteria:
Filters:
- Pattern: '{ "dynamodb" : { "Keys" : { "sk" : { "S" : [ "0" ] } } } }'
Courses:
Type: DynamoDB
Properties:
@@ -97,7 +104,7 @@ Resources:
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Enrolllments:
Enrollments:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-enrollments/stream/2023-08-22T22:56:55.612
@@ -119,15 +126,12 @@ Resources:
MaximumRetryAttempts: 5
BatchSize: 25
EventReplicateIntoMeiliFunction:
EventReplicateIntoPostgresFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.replicate_into_meili.lambda_handler
Handler: events.replicate_into_postgres.lambda_handler
LoggingConfig:
LogGroup: !Ref EventBusLog
Policies:
- EventBridgePutEventsPolicy:
EventBusName: default
LogGroup: !Ref EventPostgresLog
Events:
Users:
Type: DynamoDB
@@ -136,7 +140,7 @@ Resources:
StartingPosition: LATEST
MaximumRetryAttempts: 5
BatchSize: 25
Enrolllments:
Enrollments:
Type: DynamoDB
Properties:
Stream: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/betaeducacao-prod-enrollments/stream/2023-08-22T22:56:55.612