diff --git a/lib/infra/infra-stack.ts b/lib/infra/infra-stack.ts index 529f121df47..9d6b11cb255 100644 --- a/lib/infra/infra-stack.ts +++ b/lib/infra/infra-stack.ts @@ -336,7 +336,7 @@ export class InfraStack extends Stack { const storageVolType = `${props?.storageVolumeType ?? scope.node.tryGetContext('storageVolumeType')}`; if (storageVolType === 'undefined') { - this.storageVolumeType = getVolumeType('gp3'); + this.storageVolumeType = getVolumeType('io1'); } else { this.storageVolumeType = getVolumeType(storageVolType); } @@ -511,7 +511,11 @@ export class InfraStack extends Stack { securityGroup: props.securityGroup, blockDevices: [{ deviceName: '/dev/xvda', - volume: BlockDeviceVolume.ebs(this.dataNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }), + volume: BlockDeviceVolume.ebs(this.dataNodeStorage, { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.dataNodeStorage * 50 : 3000, + }), }], init: CloudFormationInit.fromElements(...this.getCfnInitElement(this, clusterLogGroup, 'single-node')), initOptions: { @@ -564,7 +568,11 @@ export class InfraStack extends Stack { securityGroup: props.securityGroup, blockDevices: [{ deviceName: '/dev/xvda', - volume: BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: props.storageVolumeType }), + volume: BlockDeviceVolume.ebs(50, { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? 2500 : 3000, + }), }], requireImdsv2: true, userData: UserData.forLinux(), @@ -600,7 +608,17 @@ export class InfraStack extends Stack { blockDevices: [{ deviceName: '/dev/xvda', // eslint-disable-next-line max-len - volume: (seedConfig === 'seed-manager') ? BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: props.storageVolumeType }) : BlockDeviceVolume.ebs(this.dataNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }), + volume: (seedConfig === 'seed-manager') ? BlockDeviceVolume.ebs(50, + { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? 2500 : 3000, + }) + : BlockDeviceVolume.ebs(this.dataNodeStorage, { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.dataNodeStorage * 50 : 3000, + }), }], requireImdsv2: true, userData: UserData.forLinux(), @@ -630,7 +648,11 @@ export class InfraStack extends Stack { securityGroup: props.securityGroup, blockDevices: [{ deviceName: '/dev/xvda', - volume: BlockDeviceVolume.ebs(this.dataNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }), + volume: BlockDeviceVolume.ebs(this.dataNodeStorage, { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.dataNodeStorage * 50 : 3000, + }), }], requireImdsv2: true, userData: UserData.forLinux(), @@ -663,7 +685,11 @@ export class InfraStack extends Stack { securityGroup: props.securityGroup, blockDevices: [{ deviceName: '/dev/xvda', - volume: BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: this.storageVolumeType }), + volume: BlockDeviceVolume.ebs(50, { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? 2500 : 3000, + }), }], requireImdsv2: true, userData: UserData.forLinux(), @@ -697,7 +723,11 @@ export class InfraStack extends Stack { securityGroup: props.securityGroup, blockDevices: [{ deviceName: '/dev/xvda', - volume: BlockDeviceVolume.ebs(this.mlNodeStorage, { deleteOnTermination: true, volumeType: this.storageVolumeType }), + volume: BlockDeviceVolume.ebs(this.mlNodeStorage, { + deleteOnTermination: true, + volumeType: this.storageVolumeType, + iops: (this.storageVolumeType === EbsDeviceVolumeType.IO1) ? this.mlNodeStorage * 50 : 3000, + }), }], requireImdsv2: true, userData: UserData.forLinux(), diff --git a/lib/opensearch-config/node-config.ts b/lib/opensearch-config/node-config.ts index 05583853a43..79de2d805b5 100644 --- a/lib/opensearch-config/node-config.ts +++ b/lib/opensearch-config/node-config.ts @@ -199,6 +199,8 @@ export const getVolumeType = (volumeType: string) => { return EbsDeviceVolumeType.GP2; case EbsDeviceVolumeType.GP3.valueOf(): return EbsDeviceVolumeType.GP3; + case EbsDeviceVolumeType.IO1.valueOf(): + return EbsDeviceVolumeType.IO1; default: throw new Error('Invalid volume type provided, please provide any one of the following: standard, gp2, gp3'); } diff --git a/test/opensearch-cluster-cdk.test.ts b/test/opensearch-cluster-cdk.test.ts index f2f9fba3c4e..6de9df4ef07 100644 --- a/test/opensearch-cluster-cdk.test.ts +++ b/test/opensearch-cluster-cdk.test.ts @@ -281,7 +281,8 @@ test('Test Resources with security enabled multi-node with existing Vpc with use DeviceName: '/dev/xvda', Ebs: { VolumeSize: 200, - VolumeType: 'gp3', + VolumeType: 'io1', + Iops: 10000, }, }, ], @@ -674,7 +675,7 @@ test('Throw error on unsupported ebs volume type', () => { dataNodeStorage: 200, isInternal: true, dataInstanceType: 'r5.4xlarge', - storageVolumeType: 'io1', + storageVolumeType: 'io2', }, }); // WHEN