Extreme DEvops Automation

Florian Dambrine - Senior DevOps Engineer - @GumGum

@DambrineF

> Spotinst - Let's be elastic !

  • Bye bye Autoscaling groups and launch configurations, welcome Elastigroups !

Elastigroup is a cluster orchestration and scaling service that ensures maximum availability for minimum costs.

### Launch configuration
resource "aws_launch_configuration" "this" {
  name_prefix                 = "${coalesce(var.lc_name, var.name)}-"
  image_id                    = "${var.image_id}"
  instance_type               = "${var.instance_type}"
  ...

  lifecycle {
    create_before_destroy = true
  }
}

### Autoscaling group
resource "aws_autoscaling_group" "this" {
  name_prefix          = "${coalesce(var.asg_name, var.name)}-"
  launch_configuration = "${aws_launch_configuration.this.name}"
  ...
  load_balancers            = ["${var.load_balancers}"]
}
### Spotinst Elastigroup

resource "spotinst_elastigroup_aws" "this" {
  name        = "${var.name}"
  product     = "Linux/UNIX"

  instance_types_ondemand       = "c5.large"
  instance_types_spot           = ["c5.large", "c4.large"]
  instance_types_preferred_spot = ["c5.large"]

  spot_percentage            = "0"
  fallback_to_ondemand       = true
  utilize_reserved_instances = true

  elastic_load_balancers = [
    "${var.load_balancers}",
  ]
}

asg.tf  VS.  esg.tf

> Spotinst - Let's be elastic !

Why do we love ESGs ?

  • Nicely integrated with Terraform !


     
  • Using Spotinst does not mean
    using spot-instances !

     
  • An Elastigroup offers a lot of
    useful Third-party integrations
     
  • Cleaner code / ease maintenance
resource "spotinst_elastigroup_aws" "this" {
  ...
  spot_percentage            = "0" -> "100"
  fallback_to_ondemand       = true / false
  utilize_reserved_instances = true / false
}
resource "spotinst_elastigroup_aws" "this" {
  ...
  integration_ecs {
    cluster_name             = "${var.name}"
    autoscale_is_enabled     = true
    autoscale_cooldown       = 180
    autoscale_is_auto_config = true
  }
}

 > use case - Containers  workloads

deployment Patterns

  • Must run on spot instances
  • Rolling AMI deployments

Spotinst ECS integration

  • Leveraging ECS autoscaler
  • Gracefully handle ECS registrations / drain

 > use case - run stateful applications

Immutable KAfka amis

  • Automation is great but auto-recovery is better

  • Painless management

Stateful features

  • Private IPs persistance
  • Data volume persistance

 > use case - go further with Spotinst API

>             >               >

---
pipeline:
    esg_scale:
        image: lowess/drone-spotinst-esg-scaler
        account_id: act-1234abcd
        esg_name: va-web--stage
        adjustement: +1
        secrets:
          - source: spotinst_api_token
            target: api_token
Made with Slides.com