Skip to main content

Spot Elastigroup

info

Currently, Spot Elastigroup support is behind the feature flag SPOT_ELASTIGROUP_NG. Contact Harness Support to enable the feature.

This topic describes how to deploy AWS ASG deployments using Harness and the Spot Elastigroup management platform.

Requirements and limitations

  • Currently, Harness integrates with Spot only for Amazon Web Services (AWS) deployments by using Elastigroups.
  • Spot Elastigroup deployments support AMI artifacts only.
  • Spot Elastigroup deployments support only Basic, Canary, and Blue Green execution types.
  • Your spot account must be connected to the AWS cloud provider. For more information, go to Connect your cloud account to Spot.
  • Currently, Harness does not support using Spot Elastigroup with an OIDC-enabled AWS connector.

Connect to a Spot cloud provider

You can connect Harness to a Spot cloud provider by adding a Harness Spot Elastigroup connector or AWS connector.

To connect to a Spot cloud provider using Spot's API, go to Spot API authentication.

To use an AWS connector, your spot account must first be connected to the AWS cloud provider. For more information, go to Connect your cloud account to Spot.

Create the Harness Spot Elastigroup pipeline

You can create a service and environment either when you are building the pipeline or separately in Services and Environments. This topic walks you through building these within a pipeline.

The pipeline models the release process using execution steps, triggers, and other settings. For more information, go to CD pipeline modeling overview.

  1. In your Harness Project, select Deployments.
  2. Select Pipelines, and then select Create a Pipeline.
  3. Enter the name Spot Tutorial for the pipeline, and then select Start.
  4. Select Add Stage.
  5. Select Deploy.
  6. In Stage Name, enter Spot Tutorial.
  7. In Deployment Type, select Spot Elastigroup, and then select Set Up Stage.

The new stage is created. Next, we'll add a Harness service to represent the application you're deploying, and configure the service with the Spot Elastigroup service definition, artifacts, environment definition, and infrastructure for deployment.

Add a Harness service

Harness services represent your microservices or applications. You can add the same service to as many stages as you need. For more information, go to services and environments overview.

Here's a sample Spot service YAML:

service:
name: spot-svc
identifier: spotsvc
serviceDefinition:
type: Elastigroup
spec:
artifacts:
primary:
primaryArtifactRef: <+input>
sources:
- identifier: spot_ami
spec:
connectorRef: org.AWSConnectorForAutomationTest
region: us-east-1
version: <+input>.allowedValues(asgAmi-Orderv2,asgAmi-Order)
type: AmazonMachineImage
gitOpsEnabled: false

Add a Spot environment

Define the environment where you will deploy your application.

Here's a sample infrastructure definition YAML:

infrastructureDefinition:
name: spot-infra
identifier: spotinfra
description: ""
tags: {}
orgIdentifier: Ng_Pipelines_K8s_Organisations
projectIdentifier: DoNotDelete_IvanBalan
environmentRef: Spot
deploymentType: Elastigroup
type: Elastigroup
spec:
connectorRef: spotinstconn
configuration:
store:
type: Harness
spec:
files:
- /spot/spot-cfg
allowSimultaneousDeployments: false

Spot Elastigroup pipeline execution strategies

Now you can select a deployment strategy for this stage of the pipeline.

info

Spot Elastigroup deployments support only Basic, Canary, and Blue Green execution types.

Spot Elastigroups perform the functions that Auto Scaling Groups perform in standard AMI deployments. By default, a Harness Spot Elastigroup Basic deployment pre-configures the following steps:

  • Elastigroup Setup: Specify how many instances to launch, and their steady state timeout.
  • Elastigroup Deploy: Specify how many instances to deploy, as a number or percentage of the Elastigroup parameters you've set up.
  1. In Execution Strategies, select Basic, then select Use Strategy.

  2. The basic execution steps are added.

  3. Select the Elastigroup Setup step to define Step Parameters.

    • Name: Enter the deployment step name.
    • Timeout: Set how long you want the Harness Delegate to wait for the Spot cloud to respond to API requests before timeout.
    • App Name: Enter a name for the Elastigroup app name that Harness will create. For example, you can use Harness expressions, such as <+project.identifier>_<+service.identifier>_<+env.identifier>_basic2. You can select a fixed value, runtime input, or expression for this field.
    • In Instances, select:
      • Same as already running instances: Replicate the already running instances.
      • Fixed: Enter Min Instances, Max Instances, and Desired Instances.
  4. Select the Elastigroup Deploy step to define Step Parameters.

    • Name: Enter the deployment step name.
    • Timeout: Set how long you want the Harness Delegate to wait for the Spot cloud to respond to API requests before timeout.
    • New Service: Select:
      • Percent: Specify a percentage of the target instances that you set in the Elastigroup Setup step.
      • Count: Specify the exact number of instances. This cannot exceed the Max Instances that you set in the Elastigroup Setup step.
  5. In the Advanced settings of all steps, you can use the following options:

  6. Select Apply Changes.

  7. Select Save.

Now the pipeline stage is complete and can be deployed. Select Run to run the pipeline.

See also

For frequently asked questions about AWS deployments in Harness, go to AWS deployment FAQs.