@@ -417,7 +417,7 @@ Resources:
417417 - kms:Encrypt
418418 - kms:ReEncrypt*
419419 - kms:Decrypt
420- Resource : !GetAtt PrescriptionStatusUpdatesKMSKey .Arn
420+ Resource : !GetAtt PrescriptionNotificationStateKMSKey .Arn
421421
422422 PrescriptionNotificationStateTable :
423423 Type : AWS::DynamoDB::Table
@@ -426,29 +426,19 @@ Resources:
426426 PointInTimeRecoverySpecification :
427427 PointInTimeRecoveryEnabled : true
428428 AttributeDefinitions :
429- - AttributeName : PrescriptionID
430- AttributeType : S
431429 - AttributeName : NHSNumber
432430 AttributeType : S
431+ - AttributeName : ODSCode
432+ AttributeType : S
433433 KeySchema :
434- - AttributeName : PrescriptionID
435- KeyType : HASH
434+ - AttributeName : NHSNumber
435+ KeyType : HASH # Partition key
436+ - AttributeName : ODSCode
437+ KeyType : RANGE # Sort key
436438 BillingMode : !If
437439 - EnableDynamoDBAutoScalingCondition
438440 - PROVISIONED
439441 - PAY_PER_REQUEST
440- GlobalSecondaryIndexes :
441- - IndexName : NotificationNHSNumberIndex
442- KeySchema :
443- - AttributeName : NHSNumber
444- KeyType : HASH
445- Projection :
446- ProjectionType : ALL
447- ProvisionedThroughput : !If
448- - EnableDynamoDBAutoScalingCondition
449- - ReadCapacityUnits : 1
450- WriteCapacityUnits : !Ref MinWritePrescriptionNotificationStateCapacity
451- - !Ref " AWS::NoValue"
452442 ProvisionedThroughput : !If
453443 - EnableDynamoDBAutoScalingCondition
454444 - ReadCapacityUnits : 1
@@ -524,59 +514,6 @@ Resources:
524514 PredefinedMetricSpecification :
525515 PredefinedMetricType : DynamoDBReadCapacityUtilization
526516
527- # Scaling for the indexes
528- NotificationNHSNumberIndexScalingWriteTarget :
529- Type : AWS::ApplicationAutoScaling::ScalableTarget
530- DependsOn : PrescriptionNotificationStateTable
531- Condition : EnableDynamoDBAutoScalingCondition
532- Properties :
533- MinCapacity : !Ref MinWritePrescriptionNotificationStateCapacity
534- MaxCapacity : !Ref MaxWritePrescriptionNotificationStateCapacity
535- ResourceId : !Sub table/${PrescriptionNotificationStateTable}/index/NotificationNHSNumberIndex
536- RoleARN : !GetAtt DynamoDbScalingRole.Arn
537- ScalableDimension : " dynamodb:index:WriteCapacityUnits"
538- ServiceNamespace : dynamodb
539-
540- NotificationNHSNumberIndexScalingWritePolicy :
541- Type : AWS::ApplicationAutoScaling::ScalingPolicy
542- Condition : EnableDynamoDBAutoScalingCondition
543- Properties :
544- PolicyName : NotificationNHSNumberIndexScalingWritePolicy
545- PolicyType : TargetTrackingScaling
546- ScalingTargetId : !Ref NotificationNHSNumberIndexScalingWriteTarget
547- TargetTrackingScalingPolicyConfiguration :
548- TargetValue : 50
549- ScaleInCooldown : 600
550- ScaleOutCooldown : 0
551- PredefinedMetricSpecification :
552- PredefinedMetricType : DynamoDBWriteCapacityUtilization
553-
554- NotificationNHSNumberIndexScalingReadTarget :
555- Type : AWS::ApplicationAutoScaling::ScalableTarget
556- DependsOn : PrescriptionNotificationStateTable
557- Condition : EnableDynamoDBAutoScalingCondition
558- Properties :
559- MinCapacity : 1
560- MaxCapacity : 100
561- ResourceId : !Sub table/${PrescriptionNotificationStateTable}/index/NotificationNHSNumberIndex
562- RoleARN : !GetAtt DynamoDbScalingRole.Arn
563- ScalableDimension : " dynamodb:index:ReadCapacityUnits"
564- ServiceNamespace : dynamodb
565-
566- NotificationNHSNumberIndexScalingReadPolicy :
567- Type : AWS::ApplicationAutoScaling::ScalingPolicy
568- Condition : EnableDynamoDBAutoScalingCondition
569- Properties :
570- PolicyName : NotificationNHSNumberIndexReadScalingPolicy
571- PolicyType : TargetTrackingScaling
572- ScalingTargetId : !Ref NotificationNHSNumberIndexScalingReadTarget
573- TargetTrackingScalingPolicyConfiguration :
574- TargetValue : 70
575- ScaleInCooldown : 60
576- ScaleOutCooldown : 60
577- PredefinedMetricSpecification :
578- PredefinedMetricType : DynamoDBReadCapacityUtilization
579-
580517Outputs :
581518 PrescriptionStatusUpdatesTableName :
582519 Description : PrescriptionStatusUpdates table name
0 commit comments