fbpx

Elastic Beanstalk

This post demonstrates how to create an Elastigroup integrated with Elastic Beanstalk using the Spotinst Terraform plugin.

This post assumes that you already have a Spotinst account and went through Spotinst Terraform Installation & Configuration.
Example Usage – Beanstalk Elastigroup

Create an elastigroup based on an existing beanstalk environment

resource "spotinst_beanstalk_elastigroup" "bseg1" {
  name                       = "elastigroup-beanstalk-import-example"
  region                     = "us-west-2"
  product                    = "Linux/UNIX"
  minimum                    = 1
  maximum                    = 30
  target                     = 2
  spot_instance_types        = ["m4.large","c4.large"]
  beanstalk_environment_name = "Environment-Name-1"
}
Argument Reference

The following arguments are supported:

  • name – (Required) The name of the elastigroup.
  • region – (Required) The Beanstalk environment region.
  • product – (Optional) Operating system.
  • minimum – (Required) Minimal amount of instances in the group when scaling.
  • maximum – (Required) Maximal amount of instances in the group when scaling.
  • target – (Required) Amount of instances to spin in the group.
  • spot_instance_types – (Required) A list of strings. Each is a spot instance type name. See example above.
  • beanstalk_environment_name – (Required) The Beanstalk environment name.
Attributes Reference

The following attribute is exported:

  • id – The elastigroup ID.