Skip to content

Commit af1f6bd

Browse files
authored
fix(opensearchservice): IM4GN instances don't support EBS (#27765)
Relevant docs https://aws.amazon.com/opensearch-service/pricing/ Closes #27757. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b217e6b commit af1f6bd

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,8 +1525,8 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
15251525

15261526
// Validate against instance type restrictions, per
15271527
// https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html
1528-
if (isSomeInstanceType('i3', 'r6gd') && ebsEnabled) {
1529-
throw new Error('I3 and R6GD instance types do not support EBS storage volumes.');
1528+
if (isSomeInstanceType('i3', 'r6gd', 'im4gn') && ebsEnabled) {
1529+
throw new Error('I3, R6GD, and IM4GN instance types do not support EBS storage volumes.');
15301530
}
15311531

15321532
if (isSomeInstanceType('m3', 'r3', 't2') && encryptionAtRestEnabled) {
@@ -1541,10 +1541,10 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
15411541
throw new Error('T2 and T3 instance types do not support UltraWarm storage.');
15421542
}
15431543

1544-
// Only R3, I3 and r6gd support instance storage, per
1544+
// Only R3, I3, R6GD, and IM4GN support instance storage, per
15451545
// https://aws.amazon.com/opensearch-service/pricing/
1546-
if (!ebsEnabled && !isEveryDatanodeInstanceType('r3', 'i3', 'r6gd')) {
1547-
throw new Error('EBS volumes are required when using instance types other than r3, i3 or r6gd.');
1546+
if (!ebsEnabled && !isEveryDatanodeInstanceType('r3', 'i3', 'r6gd', 'im4gn')) {
1547+
throw new Error('EBS volumes are required when using instance types other than R3, I3, R6GD, or IM4GN.');
15481548
}
15491549

15501550
// Only for a valid ebs volume configuration, per

packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,8 +1809,8 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
18091809
})).toThrow(/Node-to-node encryption requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later/);
18101810
});
18111811

1812-
test('error when i3 or r6g instance types are specified with EBS enabled', () => {
1813-
expect(() => new Domain(stack, 'Domain1', {
1812+
test('error when I3, R6GD, and IM4GN instance types are specified with EBS enabled', () => {
1813+
expect(() => new Domain(stack, 'Domain2', {
18141814
version: engineVersion,
18151815
capacity: {
18161816
dataNodeInstanceType: 'i3.2xlarge.search',
@@ -1819,8 +1819,8 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
18191819
volumeSize: 100,
18201820
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
18211821
},
1822-
})).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/);
1823-
expect(() => new Domain(stack, 'Domain2', {
1822+
})).toThrow(/I3, R6GD, and IM4GN instance types do not support EBS storage volumes./);
1823+
expect(() => new Domain(stack, 'Domain3', {
18241824
version: engineVersion,
18251825
capacity: {
18261826
dataNodeInstanceType: 'r6gd.large.search',
@@ -1829,7 +1829,17 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
18291829
volumeSize: 100,
18301830
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
18311831
},
1832-
})).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/);
1832+
})).toThrow(/I3, R6GD, and IM4GN instance types do not support EBS storage volumes./);
1833+
expect(() => new Domain(stack, 'Domain4', {
1834+
version: engineVersion,
1835+
capacity: {
1836+
dataNodeInstanceType: 'im4gn.2xlarge.search',
1837+
},
1838+
ebs: {
1839+
volumeSize: 100,
1840+
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
1841+
},
1842+
})).toThrow(/I3, R6GD, and IM4GN instance types do not support EBS storage volumes./);
18331843
});
18341844

18351845
test('error when m3, r3, or t2 instance types are specified with encryption at rest enabled', () => {
@@ -1872,7 +1882,7 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
18721882
})).toThrow(/t2.micro.search instance type supports only Elasticsearch versions 1.5 and 2.3/);
18731883
});
18741884

1875-
test('error when any instance type other than R3, I3 and R6GD are specified without EBS enabled', () => {
1885+
test('error when any instance type other than R3, I3, R6GD, or IM4GN are specified without EBS enabled', () => {
18761886
expect(() => new Domain(stack, 'Domain1', {
18771887
version: engineVersion,
18781888
ebs: {
@@ -1881,16 +1891,16 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
18811891
capacity: {
18821892
masterNodeInstanceType: 'm5.large.search',
18831893
},
1884-
})).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/);
1894+
})).toThrow(/EBS volumes are required when using instance types other than R3, I3, R6GD, or IM4GN./);
18851895
expect(() => new Domain(stack, 'Domain2', {
18861896
version: engineVersion,
18871897
ebs: {
18881898
enabled: false,
18891899
},
18901900
capacity: {
1891-
dataNodeInstanceType: 'm5.large.search',
1901+
dataNodeInstanceType: 'r5.large.search',
18921902
},
1893-
})).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/);
1903+
})).toThrow(/EBS volumes are required when using instance types other than R3, I3, R6GD, or IM4GN./);
18941904
});
18951905

18961906
test('can use compatible master instance types that does not have local storage when data node type is i3 or r6gd', () => {

0 commit comments

Comments
 (0)