Code Monkey home page Code Monkey logo

terraform-aws-spot-fleet's Introduction

About

Terraform module to create AWS Spot instances for various purposes.

The module provide the following profiles:

  • ECS node
  • Common node

Params

  • name - project information, used for tags and unique iam role name
  • subnet_id - placement subnet
  • security_group_id - placement security group

Optional params with default values

  • ssh_key - default ssh pair id
  • capacity - amount of nodes (default 1)
  • type - type of launch configuration (default is common_node, currently supported values are common_node & ecs_node)
  • common_node_ami_id - AMI image used for common_node type of launch configuration (default is the most recent Amazon provided AMI)
  • ecs_node_ami_id - AMI image used for ecs_node type of launch configuration (default is the most recent Amazon provided AMI)
  • iam_instance_profile - IAM instance profile arn (required for ECS node, default is empty value)
  • ec2_type - AWS EC2 type (default t2.small)
  • userdata - userdata script body (default is empty value)
  • disk_size_root - size of instance root partition (default is 8Gb)
  • disk_size_docker - size of instance docker partition, used for ecs_node type (default is 25Gb)
  • valid_until - the date until spot request is valid (default 2033-01-01T01:00:00Z)
  • public_ip - assign public IP on EC2 node (default false)
  • internet_access - allow access to internet (default true)

Usage

Example: One linux box

module "bastion_host" {
    source               = ""
    name                 = "Bastion host"
    subnet_id            = "${aws_subnet.default.id}"
    ssh_key              = "${aws_key_pair.default.id}"
    security_group_ids   = ["${aws_security_group.myecs.id}"]
}

Example: Five ECS nodes of c5.large type

module "my_ecs_nodes" {
    source                   = "github.com/jetbrains-infra/terraform-aws-spot-fleet"
    name                     = "Example ECS cluster"
    subnet_id                = "${aws_subnet.default.id}"
    security_group_ids       = ["${aws_security_group.myecs.id}"]
    iam_instance_profile_arn = "${aws_iam_instance_profile.ecs_node.arn}" // wtf
    capacity                 = "5"
    type                     = "ecs_node" // currently supported values are "common_node" & "ecs_node"
    ec2_type                 = "c5.large"
    userdata                 = <<EOT
#!/bin/bash
echo ECS_CLUSTER="${aws_ecs_cluster.example.name}" >> /etc/ecs/ecs.config

EOT
}

terraform-aws-spot-fleet's People

Contributors

sugdyzhekov 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.