ec2-github-runner icon indicating copy to clipboard operation
ec2-github-runner copied to clipboard

[Feature Request] Add Support to Configure EBS Disk Size

Open FaisalPathboxAI opened this issue 1 year ago • 4 comments

Based on AWS SDK for Javascript, EBS disk size can be configured using BlockDeviceMappings parameter. I'm only interested to setup the BlockDeviceMappings.Ebs.VolumeSize field. I was thinking if we can add an optional parameter ebs-volume-size with integer type which will be passed to BlockDeviceMappings.Ebs.VolumeSize that will be really helpful.

FaisalPathboxAI avatar Oct 16 '24 11:10 FaisalPathboxAI

Its in progress: https://github.com/machulav/ec2-github-runner/pull/189

Preen avatar Oct 30 '24 19:10 Preen

I need this.. my plan was

    ImageId: config.input.ec2ImageId,
    InstanceType: config.input.ec2InstanceType,
    MinCount: 1,
    MaxCount: 1,
    UserData: Buffer.from(userData.join('\n')).toString('base64'),
    SubnetId: config.input.subnetId,
    SecurityGroupIds: [config.input.securityGroupId],
    IamInstanceProfile: { Name: config.input.iamRoleName, Arn: config.input.iamRoleArn },
    TagSpecifications: config.tagSpecifications,

    // Define the root volume size
    BlockDeviceMappings: [
      {
        DeviceName: "/dev/xvda", // Default root volume device name
        Ebs: {
          VolumeSize: config.input.volumeSize || 8, // Set the volume size, default to 8 GiB if not specified
          VolumeType: "gp2", // General Purpose SSD (you can choose gp3 or other types as needed)
          DeleteOnTermination: true, // Optionally delete volume on instance termination
        },
      },
    ],
  };

  try {
    const result = await ec2.runInstances(params).promise();
    const ec2InstanceId = result.Instances[0].InstanceId;
    core.info(`AWS EC2 instance ${ec2InstanceId} is started`);
    return ec2InstanceId;
  } catch (error) {
    core.error('AWS EC2 instance starting error');
    throw error;
  }
}

stecullum avatar Nov 14 '24 18:11 stecullum

I'm adding support to pass the full BlockDeviceMappings settings in https://github.com/machulav/ec2-github-runner/pull/229

ktdreyer avatar May 16 '25 20:05 ktdreyer

@FaisalPathboxAI See also #212. Can you test #229 and report back?

mcassaniti avatar Jul 01 '25 01:07 mcassaniti