From 8d0bb19385ceafdf64b003473064ba75dd4ff4b5 Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Mon, 21 Oct 2024 15:34:51 -0700 Subject: [PATCH] add x64 instance-based ec2 options Signed-off-by: Rishabh Singh --- lib/opensearch-config/node-config.ts | 18 ++++++++++++++++++ package-lock.json | 11 ++--------- test/opensearch-cluster-cdk.test.ts | 6 +++--- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/opensearch-config/node-config.ts b/lib/opensearch-config/node-config.ts index 79de2d805b5..9bb2e7b16c5 100644 --- a/lib/opensearch-config/node-config.ts +++ b/lib/opensearch-config/node-config.ts @@ -44,11 +44,17 @@ export enum x64Ec2InstanceType { C5_LARGE = 'c5.large', C5_XLARGE = 'c5.xlarge', C5_2XLARGE = 'c5.2xlarge', + C5D_XLARGE = 'c5d.xlarge', + C5D_2XLARGE = 'c5d.2xlarge', R5_LARGE = 'r5.large', R5_XLARGE = 'r5.xlarge', R5_2XLARGE = 'r5.2xlarge', R5_4XLARGE = 'r5.4xlarge', R5_8XLARGE = 'r5.8xlarge', + R5D_XLARGE = 'r5d.xlarge', + R5D_2XLARGE = 'r5d.2xlarge', + R5D_4XLARGE = 'r5d.4xlarge', + R5D_8XLARGE = 'r5d.8xlarge', G5_LARGE = 'g5.large', G5_XLARGE = 'g5.xlarge', I3_LARGE = 'i3.large', @@ -103,6 +109,10 @@ export const getX64InstanceTypes = (instanceType: string): InstanceTypeInfo => { return { instance: InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE), hasInternalStorage: false }; case x64Ec2InstanceType.C5_2XLARGE: return { instance: InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE2), hasInternalStorage: false }; + case x64Ec2InstanceType.C5D_XLARGE: + return { instance: InstanceType.of(InstanceClass.C5D, InstanceSize.XLARGE), hasInternalStorage: true }; + case x64Ec2InstanceType.C5D_2XLARGE: + return { instance: InstanceType.of(InstanceClass.C5D, InstanceSize.XLARGE2), hasInternalStorage: true }; case x64Ec2InstanceType.R5_LARGE: return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.LARGE), hasInternalStorage: false }; case x64Ec2InstanceType.R5_XLARGE: @@ -113,6 +123,14 @@ export const getX64InstanceTypes = (instanceType: string): InstanceTypeInfo => { return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE4), hasInternalStorage: false }; case x64Ec2InstanceType.R5_8XLARGE: return { instance: InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE8), hasInternalStorage: false }; + case x64Ec2InstanceType.R5D_XLARGE: + return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE), hasInternalStorage: true }; + case x64Ec2InstanceType.R5D_2XLARGE: + return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE2), hasInternalStorage: true }; + case x64Ec2InstanceType.R5D_4XLARGE: + return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE4), hasInternalStorage: true }; + case x64Ec2InstanceType.R5D_8XLARGE: + return { instance: InstanceType.of(InstanceClass.R5D, InstanceSize.XLARGE8), hasInternalStorage: true }; case x64Ec2InstanceType.G5_LARGE: return { instance: InstanceType.of(InstanceClass.G5, InstanceSize.LARGE), hasInternalStorage: true }; case x64Ec2InstanceType.G5_XLARGE: diff --git a/package-lock.json b/package-lock.json index 12fa0b8c1a4..cdd282c385a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@opensearch-project/opensearch-cluster-cdk", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@opensearch-project/opensearch-cluster-cdk", - "version": "1.3.0", + "version": "1.4.0", "dependencies": { "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", @@ -1922,10 +1922,6 @@ "inBundle": true, "license": "MIT" }, - "node_modules/aws-cdk-lib/node_modules/fast-uri": { - "version": "3.0.1", - "license": "MIT" - }, "node_modules/aws-cdk-lib/node_modules/fs-extra": { "version": "11.2.0", "inBundle": true, @@ -8372,9 +8368,6 @@ "version": "3.1.3", "bundled": true }, - "fast-uri": { - "version": "3.0.1" - }, "fs-extra": { "version": "11.2.0", "bundled": true, diff --git a/test/opensearch-cluster-cdk.test.ts b/test/opensearch-cluster-cdk.test.ts index e01ee5ab156..f58f4656f21 100644 --- a/test/opensearch-cluster-cdk.test.ts +++ b/test/opensearch-cluster-cdk.test.ts @@ -438,9 +438,9 @@ test('Throw error on ec2 instance outside of enum list', () => { } catch (error) { expect(error).toBeInstanceOf(Error); // @ts-ignore - expect(error.message).toEqual('Invalid instance type provided, please provide any one the following: ' - + 'm5.xlarge,m5.2xlarge,c5.large,c5.xlarge,c5.2xlarge,r5.large,r5.xlarge,r5.2xlarge,r5.4xlarge,r5.8xlarge,g5.large,' - + 'g5.xlarge,i3.large,i3.xlarge,i3.2xlarge,i3.4xlarge,i3.8xlarge,inf1.xlarge,inf1.2xlarge'); + expect(error.message).toEqual('Invalid instance type provided, please provide any one the following: m5.xlarge,m5.2xlarge,c5.large,c5.xlarge,' + + 'c5.2xlarge,c5d.xlarge,c5d.2xlarge,r5.large,r5.xlarge,r5.2xlarge,r5.4xlarge,r5.8xlarge,r5d.xlarge,r5d.2xlarge,r5d.4xlarge,r5d.8xlarge,' + + 'g5.large,g5.xlarge,i3.large,i3.xlarge,i3.2xlarge,i3.4xlarge,i3.8xlarge,inf1.xlarge,inf1.2xlarge'); } });