Skip to content

Commit

Permalink
Fix the default instance type issue for single node domain creation (#51
Browse files Browse the repository at this point in the history
)

Signed-off-by: Ticheng Lin <ticheng@amazon.com>
  • Loading branch information
ticheng-aws authored Sep 5, 2023
1 parent 791d509 commit 2d3e07b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/infra/infra-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ export class InfraStack extends Stack {
this.instanceRole.addToPolicy(remoteStoreObj.getRemoteStoreBucketPolicy());
}

const singleNodeInstanceType = (props.cpuType === AmazonLinuxCpuType.X86_64)
? InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE) : InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE);
let singleNodeInstanceType: InstanceType;
if (props.dataEc2InstanceType) {
singleNodeInstanceType = props.dataEc2InstanceType;
} else if (props.cpuType === AmazonLinuxCpuType.X86_64) {
singleNodeInstanceType = InstanceType.of(InstanceClass.R5, InstanceSize.XLARGE) ;
} else {
singleNodeInstanceType = InstanceType.of(InstanceClass.R6G, InstanceSize.XLARGE);
}

const defaultInstanceType = (props.cpuType === AmazonLinuxCpuType.X86_64)
? InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE) : InstanceType.of(InstanceClass.C6G, InstanceSize.XLARGE);
Expand Down
2 changes: 2 additions & 0 deletions test/os-cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ test('Test Resources with security enabled single-node cluster', () => {
restrictServerAccessTo: 'pl-12345',
dataNodeStorage: 200,
isInternal: true,
dataInstanceType: 'r5.large',
storageVolumeType: 'gp3',
},
});
Expand All @@ -195,6 +196,7 @@ test('Test Resources with security enabled single-node cluster', () => {
infraTemplate.resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 2);
infraTemplate.resourceCountIs('AWS::ElasticLoadBalancingV2::TargetGroup', 2);
infraTemplate.hasResourceProperties('AWS::EC2::Instance', {
InstanceType: 'r5.large',
BlockDeviceMappings: [
{
Ebs: {
Expand Down

0 comments on commit 2d3e07b

Please sign in to comment.