Spotinst & Terraform Getting Started – Create Cost-Efficient Auto Scaling on AWS

How to use Spotinst & Terraform

In this post, we will explain how to create a cost-efficient Auto-Scaling in AWS using Spotinst Terraform plugin.

Install Terraform

Get the latest Terraform build, and make sure you have the Spotinst provider installed there

 

Connect Spotinst as a Provider

provider "spotinst" {
  token = "spotinst-token"  #genereate in the Spotinst Console / API
  account = "act-123abcd"   #your spotinst account ID (starts with act-)
}
resource "spotinst_elastigroup_aws" "spot-elastigroup-tf-provider-v2" {

 # Group Parameters 

 # Full list of parameters here ; https://api.spotinst.com/integration-docs/elastigroup/provisioning-tools/terraform/resources/terraform-v-2/elastigroup/

}
For more detailed info about each property – please use the documentation.

 

Once you have everything setup correctly, you can execute your Terraform file and apply the changes. It should trigger an API call to Spotinst, and create an Elatigroup.