diff --git a/source/common/changes/@awssolutions/cdf-assetlibrary-history/fix_dynamo_capacity_cfn_2024-02-26-16-02.json b/source/common/changes/@awssolutions/cdf-assetlibrary-history/fix_dynamo_capacity_cfn_2024-02-26-16-02.json new file mode 100644 index 000000000..fd278320e --- /dev/null +++ b/source/common/changes/@awssolutions/cdf-assetlibrary-history/fix_dynamo_capacity_cfn_2024-02-26-16-02.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@awssolutions/cdf-assetlibrary-history", + "comment": "expose dynamo capacity values through cloudformation", + "type": "none" + } + ], + "packageName": "@awssolutions/cdf-assetlibrary-history" +} \ No newline at end of file diff --git a/source/common/changes/@awssolutions/cdf-installer/fix_dynamo_capacity_cfn_2024-02-26-16-02.json b/source/common/changes/@awssolutions/cdf-installer/fix_dynamo_capacity_cfn_2024-02-26-16-02.json new file mode 100644 index 000000000..ffda6871b --- /dev/null +++ b/source/common/changes/@awssolutions/cdf-installer/fix_dynamo_capacity_cfn_2024-02-26-16-02.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@awssolutions/cdf-installer", + "comment": "expose dynamo capacity values in the installer", + "type": "none" + } + ], + "packageName": "@awssolutions/cdf-installer" +} \ No newline at end of file diff --git a/source/packages/services/assetlibraryhistory/infrastructure/cfn-assetLibraryHistory.yml b/source/packages/services/assetlibraryhistory/infrastructure/cfn-assetLibraryHistory.yml index 36ad0666e..a016cfafb 100644 --- a/source/packages/services/assetlibraryhistory/infrastructure/cfn-assetLibraryHistory.yml +++ b/source/packages/services/assetlibraryhistory/infrastructure/cfn-assetLibraryHistory.yml @@ -99,6 +99,11 @@ Parameters: - 'false' MinLength: 1 + DynamoProvisionedThroughputCapacity: + Description: The Read/Write units to provision on the dynamo table + Type: Number + Default: 5 + Conditions: DeployInVPC: !Not [!Equals [!Ref VpcId, 'N/A']] DeployWithLambdaAuth: @@ -248,6 +253,7 @@ Resources: reason: 'Can be decided by the customer, to specify the billing mode' Properties: TableName: !Sub 'cdf-assetlibraryhistory-${Environment}' + BillingMode: 'PROVISIONED' PointInTimeRecoverySpecification: PointInTimeRecoveryEnabled: true SSESpecification: @@ -279,11 +285,11 @@ Resources: Projection: ProjectionType: ALL ProvisionedThroughput: - ReadCapacityUnits: '5' - WriteCapacityUnits: '5' + ReadCapacityUnits: !Ref DynamoProvisionedThroughputCapacity + WriteCapacityUnits: !Ref DynamoProvisionedThroughputCapacity ProvisionedThroughput: - ReadCapacityUnits: '5' - WriteCapacityUnits: '5' + ReadCapacityUnits: !Ref DynamoProvisionedThroughputCapacity + WriteCapacityUnits: !Ref DynamoProvisionedThroughputCapacity EventsLambdaFunction: Type: AWS::Serverless::Function diff --git a/source/packages/services/installer/src/commands/modules/service/assetLibraryHistory.ts b/source/packages/services/installer/src/commands/modules/service/assetLibraryHistory.ts index 1626d84a6..b21695703 100644 --- a/source/packages/services/installer/src/commands/modules/service/assetLibraryHistory.ts +++ b/source/packages/services/installer/src/commands/modules/service/assetLibraryHistory.ts @@ -46,7 +46,22 @@ export class AssetLibraryHistoryInstaller implements RestModule { public async prompts(answers: Answers): Promise { delete answers.assetLibraryHistory?.redeploy; let updatedAnswers: Answers = await inquirer.prompt( - [redeployIfAlreadyExistsPrompt(this.name, this.stackName)], + [ + redeployIfAlreadyExistsPrompt(this.name, this.stackName), + { + message: `Provisioned Capacity for the dynamo table?`, + type: 'input', + name: 'assetLibraryHistory.dynamoCapacity', + default: answers.assetLibraryHistory?.dynamoCapacity ?? 5, + askAnswered: true, + validate(answer: number) { + if (answer > 0) { + return 'Capacity must be greater than 0'; + } + return true; + }, + }, + ], answers ); if ((updatedAnswers.assetLibraryHistory?.redeploy ?? true) === false) { @@ -75,6 +90,7 @@ export class AssetLibraryHistoryInstaller implements RestModule { `ApiGatewayDefinitionTemplate=${answers.apigw.cloudFormationTemplate}`, `AuthType=${answers.apigw.type}`, `KmsKeyId=${answers.kms.id}`, + `DynamoProvisionedThroughputCapacity=${answers.assetLibraryHistory.dynamoCapacity}`, ]; const addIfSpecified = (key: string, value: unknown) => { diff --git a/source/packages/services/installer/src/models/answers.ts b/source/packages/services/installer/src/models/answers.ts index f3f006d09..c9c133df9 100644 --- a/source/packages/services/installer/src/models/answers.ts +++ b/source/packages/services/installer/src/models/answers.ts @@ -105,10 +105,10 @@ export interface ProvisionedConcurrencyModuleAttribues extends ServiceModuleAttr } export interface NeptuneScalingAttributes { - minNeptuneReadReplicaCapacity?: number; - maxNeptuneReadReplicaCapacity?: number; - enableNeptuneAutoScaling?: boolean; - neptuneTargetUtilization?: number; + minNeptuneReadReplicaCapacity?: number; + maxNeptuneReadReplicaCapacity?: number; + enableNeptuneAutoScaling?: boolean; + neptuneTargetUtilization?: number; } export interface RestServiceModuleAttribues extends ServiceModuleAttributes { enableCustomDomain?: boolean; @@ -160,7 +160,9 @@ export interface AssetLibraryExport extends ServiceModuleAttributes { loadPath?: string; } -export type AssetLibraryHistory = RestServiceModuleAttribues; +export interface AssetLibraryHistory extends RestServiceModuleAttribues { + dynamoCapacity?: number; +} export type AuthDeviceCert = ServiceModuleAttributes;