Skip to main content
This topic explains how to scale Incredibuild Helper Agents automatically with AWS Auto Scaling Groups, using the AWS CLI or the AWS Management Console.

Prerequisites

  1. Create an Incredibuild grid that consists of the following:
  • Initiator
  • Coordinator
  • Helper (on Windows, SCL or Linux) which will be used to create the Launch Template.
  1. Ensure that you know the credentials or have the PKI key of the Helper machine.
  2. Ensure that hostname of the Helper machine is NOT static.
  3. Ensure that the Incredibuild grid (especially the Helper) is working prior to creating the Auto Scaling group. Do this by testing the build capability and ensuring the Helper is used during the build.

Create an Auto Scaling Group using AWS CLI

  1. Copy the following values from the Incredibuild grid:
  • Helper instance: <instanceID>
  • Subnet: <SubnetID>
  • Security group or list of security groups: <SecurityGroup>
  1. Select a VM size for machines to be created by the Auto Scaling group:
  • Instance type: <instanceType>, for example, c5a.2xlarge
  1. Stop the Helper instance:
  1. Create the AMI (image) from the Helper instance:
  1. Copy the AMI ID <amiID>, for example:
  1. Check the AMI creation state:
  1. When the returned State is available, create the Launch Template:
  1. Note the launch template ID <LaunchTemplateId>, for example:
  1. Create the Auto Scaling group, changing the max-size to the required integer value:
  1. Add a scaling policy to the Auto Scaling group based on metrics of CPU utilization (50%):
Full example:

Create an Auto Scaling Group using AWS Console

Gather Incredibuild Initiator Information

  1. Sign in to the AWS Management Console.
  2. Navigate to the EC2 > Instances.
  3. Select the Initiator instance and copy the following info:
  • VPC ID
  • Subnet ID
AWS Auto Scaling Groups screenshot
  1. Select the Security tab and copy the required Security Group.
AWS Auto Scaling Groups screenshot

Create an AMI from Helper Machine

  1. Sign in to the AWS Management Console.
  2. Navigate to EC2 > Instances.
  3. Select the Helper instance and choose Instance state > Stop instance. When prompted for confirmation, choose Stop. It can take a few minutes for the instance to stop.
  4. To create the AMI, select the Helper instance, select Actions > Image and templates > Create image.
  5. Enter the Image name.
  6. Select Tag image and snapshots together.
AWS Auto Scaling Groups screenshot
  1. Click Create image.
  2. Copy the Image name for future use.
AWS Auto Scaling Groups screenshot

Create Template from AMI

  1. In EC2 > Instances, select Launch Templates > Create launch template.
  2. Enter the Launch template name.
  3. Copy the Launch template name for future use.
AWS Auto Scaling Groups screenshot
  1. Under Application and OS Images (Amazon Machine Image), paste the AMI Image name.
AWS Auto Scaling Groups screenshot
  1. Press Enter. The Choose an Amazon Machine Image (AMI) page appears.
  2. Select your AMI image and then click Select.
AWS Auto Scaling Groups screenshot
  1. Scroll down and configure the Network settings:
  • From the Subnet dropdown, select the SubnetID.
  • From the Common security groups dropdown, select the Security Group ID of the grid.
AWS Auto Scaling Groups screenshot
  1. Click Create Launch template.
AWS Auto Scaling Groups screenshot
  1. Once created, a Success message appears.
AWS Auto Scaling Groups screenshot

Create Auto Scaling Group from Template

  1. In EC2, select Auto Scaling > Auto Scaling Groups.
  2. Click Create Auto Scaling group. A wizard appears.
  3. In Step 1 - Choose launch template or configuration, configure the following:
  • Enter the Auto Scaling Group name.
  • From the Launch template dropdown, select the template to be used for machine creation in the Auto Scaling group (created in Create Template from AMI).
AWS Auto Scaling Groups screenshot
  1. Click Next.
  2. In Step 2- Choose instance launch options configure the following:
  • In the Instance type requirements area, select the base model for the Helper machine to be used for scaling. Either select a specific AWS instance type or configure it manually.
AWS Auto Scaling Groups screenshot
  • (Optional) In the Instance purchase options area, select On-Demand or Spot instances.
AWS Auto Scaling Groups screenshot
  • In the Network area, select the VPC ID and Subnet ID copied from the Initiator configuration.
AWS Auto Scaling Groups screenshot
  1. Click Next.
  2. In Step 3(optional) - Configure advanced options, click Next.
  3. In Step 4 (optional) - Configure group size and scaling, provision the scaling of the Helpers group:
  • In the Group size area, enter the Desired capacity of the group.
  • In the Scaling area, enter the Min desired capacity and Max desired capacity (minimum and maximum number of Helpers in the grid).
  • Select the Target tracking scaling policy.
  • From the Metric type dropdown, select Average CPU utilization. This metric is used for sizing.
  • Enter a Target Value, for example, 50, meaning 50% CPU usage.
  • In Instance warmup, enter the number of seconds that it takes for a newly launched instance to warm up. Until its specified warmup time has expired, an instance is not counted toward the aggregated EC2 instance metrics. In this example, 60 seconds.
AWS Auto Scaling Groups screenshot
  1. Click Next until you get to the end of the wizard.
  2. Click Skip to review at the bottom of the page.
  3. In the Review page, scroll down and click Create Auto Scaling group. The Auto Scaling Groups page appears.
AWS Auto Scaling Groups screenshot
  1. Note that the first Helper instance is started (Updating capacity).
  2. Click on group Name.
  3. On the Details tab, scroll down to Advanced configurations and click Edit.
  4. Set the Default cooldown to 0 second.
  5. Click Update. This means that instances are terminated immediately when there is no need for scale capacity.
AWS Auto Scaling Groups screenshot
  1. On the Activity tab, view the log of the latest actions. Each time an additional instance is created or terminated, it appears in the log.
AWS Auto Scaling Groups screenshot
  1. On the Instance management tab, view the details of the active instances. For example, when a new Helper is created. The new Helper instance also appears in the Coordinator Management page a short while later.
AWS Auto Scaling Groups screenshot
  1. Now start the build with Incredibuild. When the CPU utilization on the Helper machine exceeds 50%, new instances are created.
  2. Navigate to your group in EC2 > the Auto Scaling groups, and view the Activity history in the Activity tab.
AWS Auto Scaling Groups screenshot

Create an Auto Scaling Group with Mixed Instance Types

Create an Auto Scaling Group with Mixed Instance Types using AWS Console

  1. To create an Auto Scaling group with mixed instance types, in Step 2- Choose instance launch options click Override launch template.
AWS Auto Scaling Groups screenshot
  1. Configure the specific Instance types requirements and the On-Demand and Spot instances.
AWS Auto Scaling Groups screenshot

Create an Auto Scaling Group with Mixed Instance Types using AWS CLI

  • To create an Auto Scaling group with mixed instance type in AWS CLI:

Create an SCL Helper for the Auto Scaling Group

Create an SCL Helper

A VPC, subnet and security groups are required to connect the Auto Scaling group instance to an existing Incredibuild grid (Coordinator/Initiator machines) and to your machine for AMI updates.
  1. In the AWS Management Console, navigate to EC2 > AMI Catalog.
  2. Filter, locate, and select the required AMI.
AWS Auto Scaling Groups screenshot
  1. In the upper-right corner, click Launch instance from AMI. The Launch an instance page appears.
  2. Complete the following:
    • Name: Helper-SCL
    • Instance type: c5a.2xlarge
    • Key pair (login): If you already have a key pair that you use to connect to your instances, select it. Otherwise, choose Create new key pair. A <key_pair_name>.pem file will be downloaded and can be used to connect to the instance.
    • Network settings: Select the appropriate VPC, subnet, and security group(s).
    • Configure storage: At least 20 GB.
  3. Click Launch instance.
AWS Auto Scaling Groups screenshot
  1. Copy the Instance ID (for example, i-0b0edfce604652eff) and open the instance details page.
  2. Once the instance reaches the Running state, note its Public IPv4 address. Use SSH or SCP to connect to the instance. On Windows, it is recommended to use a Bash-based SSH client, such as Git Bash or MobaXterm.
  3. Before proceeding, obtain the Incredibuild console installer (ibsetup_<version>_console.exe). Ensure that the installer version matches the Incredibuild version deployed in your grid.
  4. Create a folder named SCL and copy the installer into it.
  5. Within the SCL folder, create a file named Dockerfile with the following contents:
  • Note: The Helper is created in the Universal Helpers build group, and it will be able to allocate Helper cores to all available Initiators in the grid.
  1. Create a file named winemodal.sh with the following contents:
  1. Tar (or 7zip on Windows) the SCL folder with the three files:
  • winemodal.sh
  • Dockerfile
  • ibsetup_<version>_console.exe
  1. In Bash, for example, Git Bash:
  1. Once the file is copied to the instance, connect to the instance with SSH:
  1. Once logged in, run the following commands:
  1. Connect again with SSH:
  1. Once logged in, run the following commands:

Create an AMI from SCL Helper using AWS Console

  1. Sign in to the AWS Management Console.
  2. Navigate to EC2 > Instances.
  3. Select the Helper instance and choose Instance state > Stop instance. When prompted for confirmation, choose Stop. It can take a few minutes for the instance to stop.
  4. To create the AMI, select the Helper instance, select Actions > Image and templates > Create image.
  5. Enter the Image name (Helper-SCL).
  6. Add a new tag with Key=Name and Value=Helper-SCL.
  7. Click Create image.

Create an AMI from SCL Helper using AWS CLI

  • To create an AMI from SCL Helper in AWS CLI:

Create a Windows Helper for the Auto Scaling Group

Create a Windows Helper

A VPC, subnet and security groups are required to connect the Auto Scaling group instance to an existing Incredibuild grid (Coordinator/Initiator machines) and to your machine for AMI updates.
  1. In the AWS Management Console, navigate to EC2 > AMI Catalog.
  2. Filter, locate, and select the required AMI.
  3. In the upper-right corner, click Launch instance from AMI. The Launch an instance page appears.
  4. Complete the following:
    • Name: Helper-WIN
    • Instance type: c5a.2xlarge
    • Key pair (login): If you already have a key pair that you use to connect to your instances, select it. Otherwise, choose Create new key pair. A <key_pair_name>.pem file will be downloaded and can be used to connect to the instance.
    • Network settings: Select the appropriate VPC, subnet, and security group(s).
    • Configure storage: At least 20 GB.
  5. Click Launch instance.
  6. Copy the Instance ID (for example, i-0b0edfce604652eff) and open the instance details page.
  7. Once the instance reaches the Running state, connect to it using RDP.
  8. Download the Remote Desktop File.
  9. Click Get Windows password, provide the .pem key file, and decrypt the administrator password.
  10. Use the downloaded RDP file and the decrypted password to connect to the Windows instance using an RDP client.
  11. Before starting, prepare the Incredibuild installation file for either GUI or console installation. Use the same version that is installed in your Incredibuild grid (ibsetup_<version>.exe or ibsetup_<version>_console.exe).
  12. Copy the installation file to the Windows instance and run the Incredibuild installation using either the GUI or the command prompt.
  13. If using the command prompt:
  • Note: The Helper is created in the Universal Helpers build group, and it will be able to allocate Helper cores to all available Initiators in the grid.
  1. Once the Incredibuild installation is completed, clear the machine state. In CMD run:
  1. After the RDP session disconnects, create the AMI from the instance.

Create a Linux Helper for the Auto Scaling Group

Create a Linux Helper

A VPC, subnet, and security groups are required to connect the Auto Scaling Group instance to an existing Incredibuild grid (Coordinator/Initiator machines) and to your machine for AMI updates.
  1. In the AWS Management Console, navigate to EC2 > AMI Catalog.
  2. Filter, locate, and select the required AMI.
AWS Auto Scaling Groups screenshot
  1. In the upper-right corner, click Launch instance from AMI. The Launch an instance page appears.
  2. Complete the following:
    • Name: Helper-LIN
    • Instance type: c5a.2xlarge
    • Key pair (login): If you already have a key pair that you use to connect to your instances, select it. Otherwise, choose Create new key pair. A <key_pair_name>.pem file will be downloaded and can be used to connect to the instance.
    • Network settings: Select the appropriate VPC, subnet, and security group(s).
    • Configure storage: At least 30 GB.
  3. Click Launch instance.
  4. Note the Instance ID (for example, i-0b0edfce604652eff) and open the instance details page.
  5. Once the instance reaches the Running state, note its public IP address and connect to it using SSH.
  6. Prepare the Linux Incredibuild installation package. Use the same version that is installed in your existing Incredibuild grid (ibsetup_linux_<version>.run).
  7. Copy the installation package to the instance using SCP.
  1. Connect to the instance using SSH.
  1. Make the installer executable and install the Helper.
  1. After the installation completes, prepare the instance for AMI creation by clearing machine-specific information.

Create an AMI from Linux Helper using AWS Console

  1. Sign in to the AWS Management Console.
  2. Navigate to EC2 > Instances.
  3. Select the Helper instance and choose Instance state > Stop instance. When prompted for confirmation, choose Stop. It can take a few minutes for the instance to stop.
  4. To create the AMI, select the Helper instance, select Actions > Image and templates > Create image.
  5. Enter the Image name (Helper-LIN).
  6. Add a new tag with Key=Name and Value=Helper-LIN.
  7. Click Create image.

Create an AMI from Linux Helper using AWS CLI

  • To create an AMI from Linux Helper in AWS CLI:

Optimize the AWS Auto Scaling Group with SCL or Windows

To optimize the AWS Auto Scaling group, run ibc_onprem, a python script, as a service on the Coordinator machine. This builds on the existing Auto Scaling group configuration by scaling Helpers based on actual Coordinator demand, enabling faster and more responsive provisioning than standard Auto Scaling behaviour.
  1. Create an AMI from the Incredibuild Helper (SCL or Windows).
  2. Copy the AMI ID, for example, ami-017821fb4a6cdf386.
  3. Create the Auto Scaling group with the following AWS CLI script, updating the AMI_ID, SUBNETS, and SECURITY_GROUPS values based on your existing grid config, as well as any optional values as described below:
Optional parameters:
  • INSTANCE_TYPE_1 and INSTANCE_TYPE_2: The instance types, and if you specify different instance types, also update the INSTANCE_CPUS_1 and INSTANCE_CPUS_2 values.
  • ON_DEMAND_PERCENT: Thepercentage for On-Demand instances. The remaining instances will be created as Spot instances. For 100% Spot instances, leave the parameter unchanged as 0.
  • MIN_SIZE/MAX_SIZE: The minimum and maximum size for the Auto Scaling group.The maximum is a multiple of the minimum and must correspond to the CPUs specified for INSTANCE_CPUS_1 and INSTANCE_CPUS_2. For example, if there are 16 CPU cores in both machines, the minimum is 16 and the maximum is a multiple of 16 (for example, 96).
  • DESIRED_CAPACITY: The initial capacity when the Auto Scaling group is created without any load (this usually corresponds to the number of CPUs in a single Helper machine).
AWS Auto Scaling Groups screenshot
AWS Auto Scaling Groups screenshot
  1. Verify that the results do not include AccessDenied errors with identity-based policy allows requirements.
  2. Copy ibc_onprem (https://github.com/Incredibuild-RND/ibc_onprem) to the Coordinator machine.
  3. Update the config.ini, editing the [AWS] section, providing your AWS Region name (region_name) and Auto Scaling group name (asg_name), as well as any optional values as described below:
Optional parameters:
  • period_sec: How frequently (in seconds) the program polls the Coordinator for demand for Helper cores.
  • evaluation_periods: How many evaluation periods(default: 3) before making a decision to scale-out/scale-in or remain on same number of Helper cores.
  • scale_in_protection_sec: To prevent “thrashing” (rapid scale in/out cycles) of instances, set this to 120 seconds or more.
  1. To apply the configuration changes, restart the ibc_onprem utility. Install the pip requirements and run ibc_onprem.py as a service, for example, using nssm.exe:

Delete Auto Scaling Group and Launch Template

  • To delete an Auto Scaling group and Launch Template in the AWS CLI:

How Required Helper Cores are Calculated

Helper core requirements are calculated separately for each Build Group. Only Build Groups with active builds are included in the calculation. For each active Build Group, the service retrieves the incredibuild_needed_helper_cores and incredibuild_available_helper_cores metrics. The total required Helper cores are calculated as the difference between the sum of the required helper cores and the sum of the available helper cores across all active Build Groups. Build Groups allow resources to be allocated independently, while the Universal Helpers Build Group can assist builds from any Build Group. To prevent over-provisioning, the service accounts for available on-premises Universal Helpers. It calculates the number of available Universal Helper cores as the reported available helper cores minus the Helper cores already provisioned in the AWS Auto Scaling Group. This value is then subtracted from the total required Helper cores to determine the additional cloud capacity that must be provisioned.

Using ibc_onprem in Parallel with ASG Dynamic Target Tracking

Using the ibc_onprem in parallel with Auto Scaling Group dynamic target tracking is possible when most of the cores are allocated by the Auto Scaling group, and core usage is not “spiky” over the day.
  • In this case, add an Auto Scaling Group dynamic target tracking:
In many cases ibc_onprem and dynamic target tracking may compete to set desired capacity. Example The Auto Scaling Group is configured with a capacity of 40 Helper cores.

Optimize the AWS Auto Scaling Group with Linux

To optimize the AWS Auto Scaling group, run ibc_onprem, a python script, as a service on the Coordinator machine. This builds on the existing Auto Scaling group configuration by scaling Helpers based on actual Coordinator demand, enabling faster and more responsive provisioning than standard Auto Scaling behaviour.
  1. Create an AMI from the Incredibuild Helper (Linux).
  2. Copy the AMI ID, for example, ami-017821fb4a6cdf386.
  3. Create the Auto Scaling group with the following AWS CLI script, updating the AMI_ID, SUBNETS, and SECURITY_GROUPS values based on your existing grid config, as well as any optional values as described below:
Optional parameters:
  • INSTANCE_TYPE_1 and INSTANCE_TYPE_2: The instance types, and if you specify different instance types, also update the INSTANCE_CPUS_1 and INSTANCE_CPUS_2 values.
  • ON_DEMAND_PERCENT: Thepercentage for On-Demand instances. The remaining instances will be created as Spot instances. For 100% Spot instances, leave the parameter unchanged as 0.
  • MIN_SIZE/MAX_SIZE: The minimum and maximum size for the Auto Scaling group.The maximum is a multiple of the minimum and must correspond to the CPUs specified for INSTANCE_CPUS_1 and INSTANCE_CPUS_2. For example, if there are 16 CPU cores in both machines, the minimum is 16 and the maximum is a multiple of 16 (for example, 96).
  • DESIRED_CAPACITY: The initial capacity when the Auto Scaling group is created without any load (this usually corresponds to the number of CPUs in a single Helper machine).
AWS Auto Scaling Groups screenshot
  1. Verify that the results do not include AccessDenied errors with identity-based policy allows requirements.
  2. Copy ibc_onprem (https://github.com/Incredibuild-RND/ibc_onprem) to the Coordinator machine.
  3. Update the config.ini, editing the [AWS] section, providing your AWS Region name (region_name) and Auto Scaling group name (asg_name), as well as any optional values as described below:
Optional parameters:
  • period_sec: How frequently (in seconds) the program polls the Coordinator for demand for Helper cores.
  • evaluation_periods: How many evaluation periods(default: 3) before making a decision to scale-out/scale-in or remain on same number of Helper cores.
  • scale_in_protection_sec: To prevent “thrashing” (rapid scale in/out cycles) of instances, set this to 120 seconds or more.
  1. To apply the configuration changes, restart the ibc_onprem utility. Install the pip requirements and run ibc_onprem.py as a service, for example, using nssm.exe:

Delete Auto Scaling Group and Launch Template

  • To delete an Auto Scaling group and Launch Template in the AWS CLI:

Using ibc_onprem in Parallel with ASG Dynamic Target Tracking

Using the ibc_onprem in parallel with Auto Scaling Group dynamic target tracking is possible when most of the cores are allocated by the Auto Scaling group, and core usage is not “spiky” over the day.
  • In this case, add an Auto Scaling Group dynamic target tracking:
In many cases ibc_onprem and dynamic target tracking may compete to set desired capacity. Example The Auto Scaling Group is configured with a capacity of 40 Helper cores.