Git Product home page Git Product logo

terraform-aws-autospotting's Introduction

AutoSpotting

Automatically convert your existing Auto Scaling groups to significantly cheaper spot instances with minimal (often zero) configuration changes.

See https://github.com/autospotting/autospotting for details.

Using the terraform-aws-autospotting module

Sources

This module can be used from the Terraform Registry or directly from this repository.

The installer defaults to the latest stable version of AutoSpotting available on the AWS Marketplace. In order to use it you first need to subscribe to it.

Alternatively you can build your own image as described in the documentation, but this comes without any support unless you're trying to contribute code via pull requests.

Using from the Terraform Registry:

module "autospotting" {
  source  = "AutoSpotting/autospotting/aws"
  # version = "0.1.2"
}

Using from this repository:

module "autospotting" {
  source = "github.com/autospotting/terraform-aws-autospotting?ref=master" # or ref=0.1.2, etc.
}

Notes:

  • If the first run gives this error message Error: Provider produced inconsistent final plan, this is expected because we generate a Dockerfile from Terraform (it's a long story). Just re-run Terraform and it should work on a second run. Sorry about this!
  • At runtime the code will run against all other enabled regions.
  • New releases of this module have been tested with Terraform 1.0 or newer, YMMV with older versions.

Setting variables

Available variables are defined in the variables file. To change the defaults, just pass in the relevant variables:

module "autospotting" {
  source                                = "github.com/autospotting/terraform-aws-autospotting"
  autospotting_min_on_demand_percentage = "33.3"
  lambda_memory_size                    = 1024
}

Or you can pass them in on the command line:

 terraform apply \
   -var autospotting_min_on_demand_percentage="33.3" \
   -var lambda_memory_size=1024

Multiple installations

You can change the names of the resources terraform will create โ€“ or run multiple instances of autospotting that target different ASGs โ€“ by using the label variables:

module "autospotting_storage" {
  source                              = "github.com/autospotting/terraform-aws-autospotting"
  label_name                          = "autospotting_storage"
  autospotting_allowed_instance_types = "i3.*"
  autospotting_tag_filters            = "spot-enabled=true,storage-optimized=true,"
}

module "autospotting_dev_memory" {
  source                              = "github.com/autospotting/terraform-aws-autospotting"
  label_name                          = "autospotting_memory"
  label_environment                   = "dev"
  autospotting_allowed_instance_types = "r5*"
  autospotting_tag_filters            = "spot-enabled=true,memory-optimized=true,environment=dev,"
}

Logs or Troubleshooting

To check logs and troubleshoot issues, you can go to the /aws/lambda/<your_lambda_function_name> CloudWatch Log group.

terraform-aws-autospotting's People

Contributors

bfin avatar cristim avatar danielris avatar jzuniga10 avatar lazzurs avatar neillturner avatar orong-pp avatar recurrence avatar richardj-bsquare avatar timboven avatar vikas027 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.