@@ -359,29 +359,37 @@ Resources:
359
359
SourceParameters :
360
360
DynamoDBStreamParameters :
361
361
MaximumRetryAttempts : 3
362
+ BatchSize : 1
363
+ StartingPosition : LATEST
362
364
DeadLetterConfig :
363
365
Arn : !GetAtt ContractsTableStreamToEventPipeDLQ.Arn
364
- StartingPosition : LATEST
365
- OnPartialBatchItemFailure : AUTOMATIC_BISECT
366
- BatchSize : 1
367
366
FilterCriteria :
368
367
Filters :
369
- - Pattern : !ToJsonString
370
- eventName : [INSERT, MODIFY]
371
- dynamodb :
372
- NewImage :
373
- contract_status :
374
- S : [DRAFT, APPROVED]
375
- Target : !GetAtt UnicornContractsEventBus.Arn
368
+ - Pattern : >-
369
+ {"eventName":["INSERT","MODIFY"],"dynamodb":{"NewImage":{"contract_status":{"S":["DRAFT","APPROVED"]}}}}
370
+ LogConfiguration :
371
+ CloudwatchLogsLogDestination :
372
+ LogGroupArn : !GetAtt ContractsTableStreamToEventPipeLogGroup.Arn
373
+ Level : ERROR
376
374
TargetParameters :
377
375
EventBridgeEventBusParameters :
378
- Source : " {{resolve:ssm:/uni-prop/UnicornContractsNamespace}}"
379
376
DetailType : ContractStatusChanged
380
- InputTemplate : !ToJsonString
381
- property_id : " <$.dynamodb.NewImage.property_id.S>"
382
- contract_id : " <$.dynamodb.NewImage.contract_id.S>"
383
- contract_status : " <$.dynamodb.NewImage.contract_status.S>"
384
- contract_last_modified_on : " <$.dynamodb.NewImage.contract_last_modified_on.S>"
377
+ Source : " {{resolve:ssm:/uni-prop/UnicornContractsNamespace}}"
378
+ InputTemplate : |-
379
+ {
380
+ "property_id": "<$.dynamodb.Keys.property_id.S>",
381
+ "contract_id": "<$.dynamodb.NewImage.contract_id.S>",
382
+ "contract_status": "<$.dynamodb.NewImage.contract_status.S>",
383
+ "contract_last_modified_on": "<$.dynamodb.NewImage.contract_last_modified_on.S>"
384
+ }
385
+ Target : !GetAtt UnicornContractsEventBus.Arn
386
+
387
+ ContractsTableStreamToEventPipeLogGroup :
388
+ Type : AWS::Logs::LogGroup
389
+ UpdateReplacePolicy : Delete
390
+ DeletionPolicy : Delete
391
+ Properties :
392
+ RetentionInDays : !FindInMap [LogsRetentionPeriodMap, !Ref Stage, Days]
385
393
386
394
# IAM Role for Event Bridge Pipe
387
395
ContractsTableStreamToEventPipeRole :
@@ -393,6 +401,9 @@ Resources:
393
401
Effect : Allow
394
402
Principal :
395
403
Service : pipes.amazonaws.com
404
+ Condition :
405
+ StringEquals :
406
+ aws:SourceAccount : !Ref AWS::AccountId
396
407
Policies :
397
408
- PolicyName : ContractsTableStreamToEventPipePolicy
398
409
PolicyDocument :
@@ -407,6 +418,7 @@ Resources:
407
418
- dynamodb:DescribeStream
408
419
- dynamodb:GetRecords
409
420
- dynamodb:GetShardIterator
421
+ - dynamodb:ListStreams
410
422
Resource : !GetAtt ContractsTable.StreamArn
411
423
- Effect : Allow
412
424
Action :
0 commit comments