Skip to content

Commit

Permalink
fix: use higher-spec EBS devices (#552)
Browse files Browse the repository at this point in the history
* fix: use higher-spec EBS devices

Signed-off-by: Justin Alvarez <[email protected]>

* fix rootDeviceName for Amazon Linux AMIs

Signed-off-by: Justin Alvarez <[email protected]>

* fix AL root device name

Signed-off-by: Justin Alvarez <[email protected]>

---------

Signed-off-by: Justin Alvarez <[email protected]>
  • Loading branch information
pendo324 authored Sep 17, 2024
1 parent fecf84d commit 5e6feb5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/asg-runner-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export class ASGRunnerStack extends cdk.Stack implements IASGRunnerStack {
let machineImage: ec2.IMachineImage;
let userDataString = '';
let asgName = '';
let rootDeviceName = '';
switch (this.platform) {
case PlatformType.MAC: {
rootDeviceName = '/dev/sda1';
if (this.arch === 'arm') {
instanceType = ec2.InstanceType.of(ec2.InstanceClass.MAC2, ec2.InstanceSize.METAL);
} else {
Expand All @@ -90,19 +92,22 @@ export class ASGRunnerStack extends cdk.Stack implements IASGRunnerStack {
case PlatformType.WINDOWS: {
instanceType = ec2.InstanceType.of(ec2.InstanceClass.M5ZN, ec2.InstanceSize.METAL);
asgName = 'WindowsASG';
rootDeviceName = '/dev/sda1';
machineImage = ec2.MachineImage.latestWindows(ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_BASE);
// We need to provide user data as a yaml file to specify runAs: admin
// Maintain that file as yaml and source here to ensure formatting.
userDataString = readFileSync('./scripts/windows-runner-user-data.yaml', 'utf8')
.replace('<STAGE>', props.stage === ENVIRONMENT_STAGE.Release ? 'release' : 'test')
.replace('<REPO>', props.type.repo)
.replace('<REGION>', props.env?.region || '');
break;

break;
}
case PlatformType.AMAZONLINUX: {
// Linux instances do not have to be metal, since the only mode of operation
// for Finch on linux currently is "native" mode, e.g. no virutal machine on host

rootDeviceName = '/dev/xvda';
let cpuType: ec2.AmazonLinuxCpuType;
if (this.arch === 'arm') {
instanceType = ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE);
Expand Down Expand Up @@ -164,8 +169,14 @@ export class ASGRunnerStack extends cdk.Stack implements IASGRunnerStack {

// Create a 100GiB volume to be used as instance root volume
const rootVolume: ec2.BlockDevice = {
deviceName: '/dev/sda1',
volume: ec2.BlockDeviceVolume.ebs(100)
deviceName: rootDeviceName,
volume: ec2.BlockDeviceVolume.ebs(100, {
volumeType: ec2.EbsDeviceVolumeType.GP3,
// throughput / 256 KiB per operation
// default is size * 3
iops: 1200,
throughput: 300
})
};

const ltName = `${asgName}LaunchTemplate`;
Expand Down

0 comments on commit 5e6feb5

Please sign in to comment.