This tutorial covers the creation of a Load Balanced Elastigroup from scratch.

To read more about GCP’s Load Balancers, Backend Services, and how they work with Elastigroup, see the following article.

The creation template is available under “Use Cases” in the Creation Wizard:


  • In the Spotinst Console, on the lefthand menu, select Elastigroups.
  • Click the  “Create Elastigroup” button on the top right.
  • Choose the “Load Balancing” use case:


The creation wizard will assist you with creating an Elastigroup with all the required resources.


Step 1: General Settings

Elastigroup Details

  • Enter a name for the group (required).
  • Enter a group Description (optional).


  • Select the percentage of Preemptible instances in the Elastigroup. The remaining percentage will be On-Demand instances.
  • Alternatively, define the exact number of On-Demand instances required in the Elastigroup.


  • Target is the number of instances the Elastigroup should maintain.
  • The Minimum and Maximum are the boundaries within which the Elastigroup can scale.


Step 2: Compute Settings

Regions & Zones

  • Select your desired zones according to region. Clicking on region will open its zones.
  • You can add multiple zones / regions to the group.

Network Settings

  • Select your desired Network and Subnets to run your Elastigroup in.
  • (Optional) Select your desired Service Account.
  • (Optional) Check the “Add Ephemeral Public IP” checkbox if you wish to assign an Ephemeral Public IP.
  • (Optional) Add network tags, you can add multiple tags.


  • The available vCPU/Memory configuration are linked to the CPU platforms in each zone.
  • Elastigroup uses the default CPU platform to maximize availability.
  • Select your desired instances types, one-by-one. For each one you’ll see the details of the type in terms of vCPUs and Memory (GB), as well as the estimated cost per month.
  • If you wish to size the instance type yourself – choose the “Custom Instance” and set the vCPU and Memory bars accordingly.
    For more on custom instance size specifications see GCP’s documentation here.

Fallback to on-demand

  • The Fallback mechanism is making sure you won’t suffer from outage when no preemptible market is available.
  • In a scale-up operation – if we can’t get an available preemptible market we would fallback to an on-demand instance, according to your selected instance type.
  • Set “Allow fall back to on-demand” checkbox to activate the fallback to OD.


Launch Specification

  • Specify your settings for instance launch.
  • Choose OS image from “Common Images” list or browse for your custom image.
  • Set disk type and size.
  • You can also add a startup script which will be executed every time your instance boots up.
  • Startup scripts can perform many actions, such as installing software, performing updates, turning on services, and any other tasks defined in the script.
    You can use startup scripts in order to easily and programmatically customize your virtual machine instances, including on new instances at creation time.

Backend Services

  • In order to add a Backend Service click on the “Add” button.
  • Set your required backend service Type (Load Balancer): Global / Regional.
  • For Global choose the backend service from the list.
  • For Regional choose the Scheme Type and than the backend service from the list.
  • You can add named ports, e.g.:
    • Name: “HTTPS”
    • Ports: “[443, 8443]”


Setup an integration from the list of available integrations:

  • Docker Swarm:
    • Click on Docker Swarm button, and set integration properties.
    • Set docker swarm properties to connect: Swarm Manager IP  + Swarm Port.
    • Click on “Test Connectivity” to validate integration is working properly.
    • To learn more on our integration to Docker Swarm please click here.


  • Expand the section by clicking the arrow on the right.
  • Add labels to your Elastigroup by setting key and value, and click on Add.


  • Expand the section by clicking the arrow on the right.
  • Add GCP custom metadata to the instances.


Step 3: Scaling Settings (Optional)

Optionally create up scaling or down scaling Policies. For more on Scaling with Elastigroup on GCP see the documentation here.

To create a policy (up scaling or down scaling) perform following steps:

  • Click on ‘Add Policy’.
  • Set policy name.
  • Set source by picking from list: Spotinst Spectrum / GCP Stackdriver
  • Set or choose required namespace according to source
  • Set scale based on values:Choose Trigger, Behavior and Dimensions.
  • Set Duration to determine amount of tests (and duration between them) to activate the policy.
  • Action Type will be “Add” on up scaling and “Remove” on down scaling policies. You need to set the amount of instances.
  • Cool-down: Wait Period is the time (in seconds) that all scaling activities will be suspended after the scaling policy is triggered.

Step 4: Review And Create

The Review tab contains a summary of your Elastigroup configuration, and you have the option to go back to any of the previous steps and change the settings.

You can optionally view the group configuration in JSON format, and edit it directly by switching on “Edit mode”.

All that’s left to do is review your settings and launch your Elastigroup!