Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(opensearchservice): IM4GN instances don't support EBS #27765

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1525,8 +1525,8 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {

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

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

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

// Only for a valid ebs volume configuration, per
Expand Down
28 changes: 19 additions & 9 deletions packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1809,8 +1809,8 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
})).toThrow(/Node-to-node encryption requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later/);
});

test('error when i3 or r6g instance types are specified with EBS enabled', () => {
expect(() => new Domain(stack, 'Domain1', {
test('error when I3, R6GD and IM4GN instance types are specified with EBS enabled', () => {
expect(() => new Domain(stack, 'Domain2', {
version: engineVersion,
capacity: {
dataNodeInstanceType: 'i3.2xlarge.search',
Expand All @@ -1819,8 +1819,8 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
volumeSize: 100,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
},
})).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/);
expect(() => new Domain(stack, 'Domain2', {
})).toThrow(/I3, R6GD and IM4GN instance types do not support EBS storage volumes./);
expect(() => new Domain(stack, 'Domain3', {
version: engineVersion,
capacity: {
dataNodeInstanceType: 'r6gd.large.search',
Expand All @@ -1829,7 +1829,17 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
volumeSize: 100,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
},
})).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/);
})).toThrow(/I3, R6GD and IM4GN instance types do not support EBS storage volumes./);
expect(() => new Domain(stack, 'Domain4', {
version: engineVersion,
capacity: {
dataNodeInstanceType: 'im4gn.2xlarge.search',
},
ebs: {
volumeSize: 100,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
},
})).toThrow(/I3, R6GD and IM4GN instance types do not support EBS storage volumes./);
});

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

test('error when any instance type other than R3, I3 and R6GD are specified without EBS enabled', () => {
test('error when any instance type other than R3, I3, R6GD or IM4GN are specified without EBS enabled', () => {
expect(() => new Domain(stack, 'Domain1', {
version: engineVersion,
ebs: {
Expand All @@ -1881,16 +1891,16 @@ each(testedOpenSearchVersions).describe('custom error responses', (engineVersion
capacity: {
masterNodeInstanceType: 'm5.large.search',
},
})).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/);
})).toThrow(/EBS volumes are required when using instance types other than R3, I3, R6GD or IM4GN./);
expect(() => new Domain(stack, 'Domain2', {
version: engineVersion,
ebs: {
enabled: false,
},
capacity: {
dataNodeInstanceType: 'm5.large.search',
dataNodeInstanceType: 'r5.large.search',
},
})).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/);
})).toThrow(/EBS volumes are required when using instance types other than R3, I3, R6GD or IM4GN./);
});

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