Skip to content

Commit

Permalink
feat: Upgrade defaults from m5.large to m6i.large for better performa…
Browse files Browse the repository at this point in the history
…nce (#574)
  • Loading branch information
kichik committed May 16, 2024
1 parent b805d28 commit 859383c
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
10 changes: 5 additions & 5 deletions API.md

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

4 changes: 2 additions & 2 deletions src/image-builders/aws-image-builder/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface AwsImageBuilderRunnerImageBuilderProps {
/**
* The instance type used to build the image.
*
* @default m5.large
* @default m6i.large
*/
readonly instanceType?: ec2.InstanceType;

Expand Down Expand Up @@ -331,7 +331,7 @@ export class AwsImageBuilderRunnerImageBuilder extends RunnerImageBuilderBase {
this.subnetSelection = props?.subnetSelection;
this.baseImage = props?.baseDockerImage ?? defaultBaseDockerImage(this.os);
this.baseAmi = props?.baseAmi ?? defaultBaseAmi(this, this.os, this.architecture);
this.instanceType = props?.awsImageBuilderOptions?.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE);
this.instanceType = props?.awsImageBuilderOptions?.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M6I, ec2.InstanceSize.LARGE);
this.fastLaunchOptions = props?.awsImageBuilderOptions?.fastLaunchOptions;
this.waitOnDeploy = props?.waitOnDeploy ?? true;
this.dockerSetupCommands = props?.dockerSetupCommands ?? [];
Expand Down
2 changes: 1 addition & 1 deletion src/image-builders/aws-image-builder/deprecated/ami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface AmiBuilderProps {
/**
* The instance type used to build the image.
*
* @default m5.large
* @default m6i.large
*/
readonly instanceType?: ec2.InstanceType;

Expand Down
2 changes: 1 addition & 1 deletion src/image-builders/aws-image-builder/deprecated/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export abstract class ImageBuilderBase extends Construct implements IRunnerImage
}

// instance type
this.instanceType = props?.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE);
this.instanceType = props?.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M6I, ec2.InstanceSize.LARGE);
if (!this.architecture.instanceTypeMatch(this.instanceType)) {
throw new Error(`Builder architecture (${this.architecture.name}) doesn't match selected instance type (${this.instanceType} / ${this.instanceType.architecture})`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface ContainerImageBuilderProps {
/**
* The instance type used to build the image.
*
* @default m5.large
* @default m6i.large
*/
readonly instanceType?: ec2.InstanceType;

Expand Down
2 changes: 1 addition & 1 deletion src/image-builders/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export interface ImageBuilderBaseProps {
/**
* The instance type used to build the image.
*
* @default m5.large
* @default m6i.large
*/
readonly instanceType?: ec2.InstanceType;

Expand Down
4 changes: 2 additions & 2 deletions src/providers/ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export interface Ec2RunnerProviderProps extends RunnerProviderProps {
/**
* Instance type for launched runner instances.
*
* @default m5.large
* @default m6i.large
*/
readonly instanceType?: ec2.InstanceType;

Expand Down Expand Up @@ -353,7 +353,7 @@ export class Ec2RunnerProvider extends BaseProvider implements IRunnerProvider {
this.vpc = props?.vpc ?? ec2.Vpc.fromLookup(this, 'Default VPC', { isDefault: true });
this.securityGroups = props?.securityGroup ? [props.securityGroup] : (props?.securityGroups ?? [new ec2.SecurityGroup(this, 'SG', { vpc: this.vpc })]);
this.subnets = props?.subnet ? [props.subnet] : this.vpc.selectSubnets(props?.subnetSelection).subnets;
this.instanceType = props?.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE);
this.instanceType = props?.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M6I, ec2.InstanceSize.LARGE);
this.storageSize = props?.storageSize ?? cdk.Size.gibibytes(30); // 30 is the minimum for Windows
this.spot = props?.spot ?? false;
this.spotMaxPrice = props?.spotMaxPrice;
Expand Down
4 changes: 2 additions & 2 deletions src/providers/ecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export interface EcsRunnerProviderProps extends RunnerProviderProps {
/**
* Instance type of ECS cluster instances. Only used when creating a new cluster.
*
* @default m5.large or m6g.large
* @default m6i.large or m6g.large
*/
readonly instanceType?: ec2.InstanceType;

Expand Down Expand Up @@ -445,7 +445,7 @@ export class EcsRunnerProvider extends BaseProvider implements IRunnerProvider {

private defaultClusterInstanceType() {
if (this.image.architecture.is(Architecture.X86_64)) {
return ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE);
return ec2.InstanceType.of(ec2.InstanceClass.M6I, ec2.InstanceSize.LARGE);
}
if (this.image.architecture.is(Architecture.ARM64)) {
return ec2.InstanceType.of(ec2.InstanceClass.M6G, ec2.InstanceSize.LARGE);
Expand Down
4 changes: 2 additions & 2 deletions test/default.integ.snapshot/github-runners-test.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@
}
}
},
"03f4ef92c163cdb444cc29e5cc2d9d55caf06a401f5be2bd8485f5d58b415a53": {
"e376a00434ff844e4066a874db82613a7fb1dba5b0b64df2dcba11a03f81ac3a": {
"source": {
"path": "github-runners-test.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "03f4ef92c163cdb444cc29e5cc2d9d55caf06a401f5be2bd8485f5d58b415a53.json",
"objectKey": "e376a00434ff844e4066a874db82613a7fb1dba5b0b64df2dcba11a03f81ac3a.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
22 changes: 11 additions & 11 deletions test/default.integ.snapshot/github-runners-test.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2718,7 +2718,7 @@
"Ref": "WindowsImageBuilderInstanceProfileBFCCEC08"
},
"InstanceTypes": [
"m5.large"
"m6i.large"
],
"Name": "github-runners-test-WindowsImageBuilder-18C0E1B2",
"SecurityGroupIds": [
Expand Down Expand Up @@ -3930,7 +3930,7 @@
"Ref": "AMILinuxBuilderInstanceProfile3CA638BE"
},
"InstanceTypes": [
"m5.large"
"m6i.large"
],
"Name": "github-runners-test-AMILinuxBuilder-67243E6D",
"SecurityGroupIds": [
Expand Down Expand Up @@ -7996,7 +7996,7 @@
"Ref": "WindowsEC2BuilderInstanceProfileA8DBA763"
},
"InstanceTypes": [
"m5.large"
"m6i.large"
],
"Name": "github-runners-test-WindowsEC2Builder-5FAF8285",
"SecurityGroupIds": [
Expand Down Expand Up @@ -9368,7 +9368,7 @@
"SpotInstanceType": "one-time"
}
},
"InstanceType": "m5.large",
"InstanceType": "m6i.large",
"MetadataOptions": {
"HttpTokens": "required"
},
Expand Down Expand Up @@ -10506,7 +10506,7 @@
}
},
"ImageId": "resolve:ssm:/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-ECS_Optimized/image_id",
"InstanceType": "m5.large",
"InstanceType": "m6i.large",
"MetadataOptions": {
"HttpTokens": "required"
},
Expand Down Expand Up @@ -15929,7 +15929,7 @@
{
"Ref": "AMILinuxBuilderLaunchtemplateA29452C4"
},
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m5.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m6i.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
{
"Ref": "EC2LinuxLogsC4CD8F14"
},
Expand Down Expand Up @@ -15967,7 +15967,7 @@
{
"Ref": "AMILinuxBuilderLaunchtemplateA29452C4"
},
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m5.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m6i.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
{
"Ref": "EC2LinuxLogsC4CD8F14"
},
Expand Down Expand Up @@ -16005,7 +16005,7 @@
{
"Ref": "AMILinuxBuilderLaunchtemplateA29452C4"
},
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m5.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m6i.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
{
"Ref": "EC2SpotLinuxLogsF78D5F0E"
},
Expand Down Expand Up @@ -16043,7 +16043,7 @@
{
"Ref": "AMILinuxBuilderLaunchtemplateA29452C4"
},
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m5.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m6i.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
{
"Ref": "EC2SpotLinuxLogsF78D5F0E"
},
Expand Down Expand Up @@ -16157,7 +16157,7 @@
{
"Ref": "WindowsEC2BuilderLaunchtemplate0A66E9C2"
},
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m5.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m6i.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
{
"Ref": "EC2WindowsLogsDC1F2ABF"
},
Expand Down Expand Up @@ -16195,7 +16195,7 @@
{
"Ref": "WindowsEC2BuilderLaunchtemplate0A66E9C2"
},
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m5.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
"\"},\"MinCount\":1,\"MaxCount\":1,\"InstanceType\":\"m6i.large\",\"UserData.$\":\"States.Base64Encode(States.Format($.ec2.userdataTemplate, $$.Task.Token, '",
{
"Ref": "EC2WindowsLogsDC1F2ABF"
},
Expand Down
4 changes: 2 additions & 2 deletions test/imagebuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('AMI builder matching instance type (DEPRECATED)', () => {
architecture: Architecture.ARM64,
vpc,
});
}).toThrowError('Builder architecture (ARM64) doesn\'t match selected instance type (m5.large / x86_64)');
}).toThrowError('Builder architecture (ARM64) doesn\'t match selected instance type (m6i.large / x86_64)');
});

test('AMI builder matching instance type', () => {
Expand All @@ -44,7 +44,7 @@ test('AMI builder matching instance type', () => {
vpc,
builderType: RunnerImageBuilderType.AWS_IMAGE_BUILDER,
});
}).toThrowError('Builder architecture (ARM64) doesn\'t match selected instance type (m5.large / x86_64)');
}).toThrowError('Builder architecture (ARM64) doesn\'t match selected instance type (m6i.large / x86_64)');
});

test('AMI builder supported OS', () => {
Expand Down

0 comments on commit 859383c

Please sign in to comment.