Skip to content

Commit

Permalink
add x64 instance-based ec2 options (#138)
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Singh <[email protected]>
  • Loading branch information
rishabh6788 authored Oct 21, 2024
1 parent 2c636f2 commit 4f804d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
18 changes: 18 additions & 0 deletions lib/opensearch-config/node-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
11 changes: 2 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/opensearch-cluster-cdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});

Expand Down

0 comments on commit 4f804d6

Please sign in to comment.