diff --git a/SAMtemplates/tables/main.yaml b/SAMtemplates/tables/main.yaml index baaf60820..c0bc7e593 100644 --- a/SAMtemplates/tables/main.yaml +++ b/SAMtemplates/tables/main.yaml @@ -11,6 +11,14 @@ Parameters: EnableDynamoDBAutoScaling: Type: String + MinWritePrescriptionStatusUpdatesCapacity: + Type: Number + Default: 50 + + MaxWritePrescriptionStatusUpdatesCapacity: + Type: Number + Default: 600 + Conditions: EnableDynamoDBAutoScalingCondition: !Equals - true @@ -81,7 +89,7 @@ Resources: ProvisionedThroughput: !If - EnableDynamoDBAutoScalingCondition - ReadCapacityUnits: 1 - WriteCapacityUnits: 1 + WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity - !Ref "AWS::NoValue" SSESpecification: KMSMasterKeyId: !Ref PrescriptionStatusUpdatesKMSKey @@ -105,7 +113,7 @@ Resources: ProvisionedThroughput: !If - EnableDynamoDBAutoScalingCondition - ReadCapacityUnits: 1 - WriteCapacityUnits: 1 + WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity - !Ref "AWS::NoValue" - IndexName: PatientNHSNumberIndex KeySchema: @@ -116,7 +124,7 @@ Resources: ProvisionedThroughput: !If - EnableDynamoDBAutoScalingCondition - ReadCapacityUnits: 1 - WriteCapacityUnits: 1 + WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity - !Ref "AWS::NoValue" PrescriptionStatusUpdatesResources: @@ -171,8 +179,8 @@ Resources: DependsOn: PrescriptionStatusUpdatesTable Condition: EnableDynamoDBAutoScalingCondition Properties: - MaxCapacity: 100 - MinCapacity: 1 + MinCapacity: !Ref MinWritePrescriptionStatusUpdatesCapacity + MaxCapacity: !Ref MaxWritePrescriptionStatusUpdatesCapacity ResourceId: !Sub table/${PrescriptionStatusUpdatesTable} RoleARN: !GetAtt DynamoDbScalingRole.Arn ScalableDimension: "dynamodb:table:WriteCapacityUnits" @@ -186,9 +194,9 @@ Resources: PolicyType: TargetTrackingScaling ScalingTargetId: !Ref PrescriptionStatusUpdatesTableWriteScalingTarget TargetTrackingScalingPolicyConfiguration: - TargetValue: 70 - ScaleInCooldown: 60 - ScaleOutCooldown: 60 + TargetValue: 50 + ScaleInCooldown: 600 + ScaleOutCooldown: 0 PredefinedMetricSpecification: PredefinedMetricType: DynamoDBWriteCapacityUtilization @@ -223,8 +231,8 @@ Resources: DependsOn: PrescriptionStatusUpdatesTable Condition: EnableDynamoDBAutoScalingCondition Properties: - MaxCapacity: 100 - MinCapacity: 1 + MinCapacity: !Ref MinWritePrescriptionStatusUpdatesCapacity + MaxCapacity: !Ref MaxWritePrescriptionStatusUpdatesCapacity ResourceId: !Sub table/${PrescriptionStatusUpdatesTable}/index/PharmacyODSCodePrescriptionIDIndex RoleARN: !GetAtt DynamoDbScalingRole.Arn ScalableDimension: "dynamodb:index:WriteCapacityUnits" @@ -238,19 +246,45 @@ Resources: PolicyType: TargetTrackingScaling ScalingTargetId: !Ref PharmacyIndexScalingWriteTarget TargetTrackingScalingPolicyConfiguration: - TargetValue: 70 - ScaleInCooldown: 60 - ScaleOutCooldown: 60 + TargetValue: 50 + ScaleInCooldown: 600 + ScaleOutCooldown: 0 PredefinedMetricSpecification: PredefinedMetricType: DynamoDBWriteCapacityUtilization - NHSNumberIndexScalingWriteTarget: + PharmacyIndexScalingReadTarget: Type: AWS::ApplicationAutoScaling::ScalableTarget DependsOn: PrescriptionStatusUpdatesTable Condition: EnableDynamoDBAutoScalingCondition Properties: MaxCapacity: 100 MinCapacity: 1 + ResourceId: !Sub table/${PrescriptionStatusUpdatesTable}/index/PharmacyODSCodePrescriptionIDIndex + RoleARN: !GetAtt DynamoDbScalingRole.Arn + ScalableDimension: "dynamodb:index:ReadCapacityUnits" + ServiceNamespace: dynamodb + + PharmacyIndexScalingReadPolicy: + Type: AWS::ApplicationAutoScaling::ScalingPolicy + Condition: EnableDynamoDBAutoScalingCondition + Properties: + PolicyName: NHSNumberIndexReadScalingPolicy + PolicyType: TargetTrackingScaling + ScalingTargetId: !Ref PharmacyIndexScalingReadTarget + TargetTrackingScalingPolicyConfiguration: + TargetValue: 70 + ScaleInCooldown: 600 + ScaleOutCooldown: 10 + PredefinedMetricSpecification: + PredefinedMetricType: DynamoDBReadCapacityUtilization + + NHSNumberIndexScalingWriteTarget: + Type: AWS::ApplicationAutoScaling::ScalableTarget + DependsOn: PrescriptionStatusUpdatesTable + Condition: EnableDynamoDBAutoScalingCondition + Properties: + MinCapacity: !Ref MinWritePrescriptionStatusUpdatesCapacity + MaxCapacity: !Ref MaxWritePrescriptionStatusUpdatesCapacity ResourceId: !Sub table/${PrescriptionStatusUpdatesTable}/index/PatientNHSNumberIndex RoleARN: !GetAtt DynamoDbScalingRole.Arn ScalableDimension: "dynamodb:index:WriteCapacityUnits" @@ -264,9 +298,9 @@ Resources: PolicyType: TargetTrackingScaling ScalingTargetId: !Ref NHSNumberIndexScalingWriteTarget TargetTrackingScalingPolicyConfiguration: - TargetValue: 70 - ScaleInCooldown: 60 - ScaleOutCooldown: 60 + TargetValue: 50 + ScaleInCooldown: 600 + ScaleOutCooldown: 0 PredefinedMetricSpecification: PredefinedMetricType: DynamoDBWriteCapacityUtilization diff --git a/packages/specification/eps-custom-prescription-status-update-api.yaml b/packages/specification/eps-custom-prescription-status-update-api.yaml index 8dc1b6bbf..805291d70 100755 --- a/packages/specification/eps-custom-prescription-status-update-api.yaml +++ b/packages/specification/eps-custom-prescription-status-update-api.yaml @@ -149,5 +149,8 @@ x-nhsd-apim: header: attribute-name ratelimiting: proxy: - timeunit: "second" - limit: 40 + limit: 20000 + timeunit: minute + app-default: + limit: 20000 + timeunit: minute diff --git a/packages/specification/eps-prescription-status-update-api.yaml b/packages/specification/eps-prescription-status-update-api.yaml index 5c7f71a1c..7f1d0329e 100755 --- a/packages/specification/eps-prescription-status-update-api.yaml +++ b/packages/specification/eps-prescription-status-update-api.yaml @@ -13,9 +13,9 @@ info: description: | ## Overview Use this API to enable dispensing suppliers to push status information about electronic prescriptions to patients on a national scale via the NHS App (and potential other third parties in the future). - + The overall aim of the service is to reduce burden to frontline NHS services by reducing the number of routine patient queries about their prescriptions. - + You can: * enable patients to know when their prescription is ready * enable dispensing suppliers to push status information about electronic prescriptions @@ -58,7 +58,7 @@ info: * 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action * 400 to 499 if it failed because of a client error by your application * 500 to 599 if it failed because of an error on our server - + Errors specific to each API are shown in the Endpoints section, under Response. See our [reference guide](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#http-status-codes) for more on errors. ## Open source You might find the following [open source](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#open-source) resources useful: @@ -128,7 +128,8 @@ paths: $ref: examples/request-ready-to-dispatch.json ready-to-dispatch-partial: summary: ready-to-dispatch-partial - description: A request message contains tracking status `Ready to Dispatch - + description: + A request message contains tracking status `Ready to Dispatch - Partial`. value: $ref: examples/request-ready-to-dispatch-partial.json @@ -166,12 +167,14 @@ paths: $ref: "#/components/schemas/ResponseBundle" examples: single-item: - description: A successful response to a UpdatePrescriptionStatus request, + description: + A successful response to a UpdatePrescriptionStatus request, contains a single item. value: $ref: examples/response-single-item.json multiple-items: - description: A successful response to a UpdatePrescriptionStatus request, + description: + A successful response to a UpdatePrescriptionStatus request, contains multiple items. value: $ref: examples/response-multiple-items.json @@ -342,7 +345,8 @@ components: - Bundle type: type: string - description: Denotes that the bundle is a list of status updates to be performed + description: + Denotes that the bundle is a list of status updates to be performed as one transaction. enum: - transaction @@ -409,5 +413,8 @@ x-nhsd-apim: header: show-all-suppliers ratelimiting: proxy: - timeunit: second - limit: 60 + limit: 20000 + timeunit: minute + app-default: + limit: 20000 + timeunit: minute