@@ -15,7 +15,7 @@ Metadata:
15
15
- ES6000 # Rule disabled because SQS DLQs don't need a RedrivePolicy
16
16
- WS2001 # Rule disabled because check does not support !ToJsonString transform
17
17
- ES1001 # Rule disabled because our Lambda functions don't need DestinationConfig.OnFailure
18
- - W3002 # Rule disabled as nested templates are being packaged
18
+ - W3002 # Rule disabled as nested templates are being packaged
19
19
20
20
Parameters :
21
21
Stage :
@@ -360,29 +360,37 @@ Resources:
360
360
SourceParameters :
361
361
DynamoDBStreamParameters :
362
362
MaximumRetryAttempts : 3
363
+ BatchSize : 1
364
+ StartingPosition : LATEST
363
365
DeadLetterConfig :
364
366
Arn : !GetAtt ContractsTableStreamToEventPipeDLQ.Arn
365
- StartingPosition : LATEST
366
- OnPartialBatchItemFailure : AUTOMATIC_BISECT
367
- BatchSize : 1
368
367
FilterCriteria :
369
368
Filters :
370
- - Pattern : !ToJsonString
371
- eventName : [INSERT, MODIFY]
372
- dynamodb :
373
- NewImage :
374
- ContractStatus :
375
- S : [DRAFT, APPROVED]
376
- Target : !GetAtt UnicornContractsEventBus.Arn
369
+ - Pattern : >-
370
+ {"eventName":["INSERT","MODIFY"],"dynamodb":{"NewImage":{"ContractStatus":{"S":["DRAFT","APPROVED"]}}}}
371
+ LogConfiguration :
372
+ CloudwatchLogsLogDestination :
373
+ LogGroupArn : !GetAtt ContractsTableStreamToEventPipeLogGroup.Arn
374
+ Level : ERROR
377
375
TargetParameters :
378
376
EventBridgeEventBusParameters :
379
- Source : " {{resolve:ssm:/uni-prop/UnicornContractsNamespace}}"
380
377
DetailType : ContractStatusChanged
381
- InputTemplate : !ToJsonString
382
- PropertyId : " <$.dynamodb.NewImage.PropertyId.S>"
383
- ContractId : " <$.dynamodb.NewImage.ContractId.S>"
384
- ContractStatus : " <$.dynamodb.NewImage.ContractStatus.S>"
385
- ContractLastModifiedOn : " <$.dynamodb.NewImage.ContractLastModifiedOn.S>"
378
+ Source : " {{resolve:ssm:/uni-prop/UnicornContractsNamespace}}"
379
+ InputTemplate : |-
380
+ {
381
+ "PropertyId": "<$.dynamodb.Keys.PropertyId.S>",
382
+ "ContractId": "<$.dynamodb.NewImage.ContractId.S>",
383
+ "ContractStatus": "<$.dynamodb.NewImage.ContractStatus.S>",
384
+ "ContractLastModifiedOn": "<$.dynamodb.NewImage.ContractLastModifiedOn.S>"
385
+ }
386
+ Target : !GetAtt UnicornContractsEventBus.Arn
387
+
388
+ ContractsTableStreamToEventPipeLogGroup :
389
+ Type : AWS::Logs::LogGroup
390
+ UpdateReplacePolicy : Delete
391
+ DeletionPolicy : Delete
392
+ Properties :
393
+ RetentionInDays : !FindInMap [LogsRetentionPeriodMap, !Ref Stage, Days]
386
394
387
395
# IAM Role for Event Bridge Pipe
388
396
ContractsTableStreamToEventPipeRole :
@@ -394,6 +402,9 @@ Resources:
394
402
Effect : Allow
395
403
Principal :
396
404
Service : pipes.amazonaws.com
405
+ Condition :
406
+ StringEquals :
407
+ aws:SourceAccount : !Ref AWS::AccountId
397
408
Policies :
398
409
- PolicyName : ContractsTableStreamToEventPipePolicy
399
410
PolicyDocument :
@@ -408,6 +419,7 @@ Resources:
408
419
- dynamodb:DescribeStream
409
420
- dynamodb:GetRecords
410
421
- dynamodb:GetShardIterator
422
+ - dynamodb:ListStreams
411
423
Resource : !GetAtt ContractsTable.StreamArn
412
424
- Effect : Allow
413
425
Action :
0 commit comments