Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

getninjas/spot-ninja

Repository files navigation

spot-ninja

Go Report Card Build Status GoDoc

Available translations:

This software is responsible for all the intelligence in increasing and decreasing AutoScalingGroups size based on Spotfleet health.

License

spot ninja is released under the terms of the Apache License. See LICENSE file for more information or see apache.

Requirements

  • Docker >=v1.13.1
  • Docker Compose >=1.23.1
  • Go >= 1.12.7
  • aws-sdk-go Module
  • yaml.v2 Module
  • Polices:
    • CloudWatchReadOnlyAccess
    • AmazonEC2SpotFleetAutoscaleRole
    • AutoScalingConsoleFullAccess

Architecture

spot-ninja

ENVs configuration

To configure the spot-ninja, you need to configure some environment variables. The variables are:

  • AWS_REGION
    • Default us-east-1
  • DATA_POINT_CONFIG
    • Default 30
  • STATISTIC_CONFIG
    • Default Average
  • FLEET_TYPE_CONFIG
    • Default FleetRequestId
  • ID_METRIC_CONFIG
    • Default metric
  • SCAN_TYPE_CONFIG
    • Default TimestampDescending
  • METRIC_NAME_CONFIG
    • Default PendingCapacity
  • NAMESPACE_CONFIG
    • Default AWS/EC2Spot
  • UNIT_CONFIG
    • Default Count
  • TIME_TO_CONFIG
    • Default 5
  • SPEED_CONFIG
    • Default 10
  • DIVIDER_CONFIG
    • Default 4
  • FLEET_IGNORED
    • Default none
  • ENABLE_EVENTS_ON_SQS
    • Default false
  • SQS_URL
    • Default none
  • PREFIX
    • Default ecs-
  • TIME_TO_LIVE
    • In seconds Default 15 min.

Installing with docker-compose

1 - Build

docker-compose build

2 - Run spot-ninja

docker-compose up

Project Structure

  • cmd/
    • main spot-ninja
  • config/
    • general configs to spot ninja
  • pkg/
    • general libs

References