Coder Social home page Coder Social logo

bastiaanvanassche / tf-ec2-startstop Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 9 KB

A Terraform module to temporarily stop and restart a pre-defined set of EC2 instances in AWS in order to reduce costs.

License: Apache License 2.0

Python 15.44% HCL 82.88% Shell 1.68%
aws aws-lambda ec2 terraform

tf-ec2-startstop's Introduction

Module ec2-startstop

This module can be used to temporarily stop and restart a pre-defined set of EC2 instances in AWS in order to reduce costs. It can be configured with the following variables:

  • ec2_instance_ids (mandatory): a list of EC2 instance IDs to start and stop.
  • cron_expr_start: cron expression to trigger the start of the EC2 instances.
  • cron_expr_stop: cron expression to trigger the stop of the EC2 instances.
  • region: the region where the EC2 instances are located. This is an optional parameter. If no region variable is specified in the calling module, the aws_region data source is used to auto-determine the current region.

The code in the module is based on this article in the AWS user guide: https://aws.amazon.com/premiumsupport/knowledge-center/start-stop-lambda-cloudwatch/

Additional notes

Pre-commit hooks

This repository contains a .pre-commit-config.yaml file. This file includes a list of git pre-commit hooks that are handy during development. In order to activate the hooks, you need to install pre-commit package manager on your machine first (one-off action).

$ pip install pre-commit

Next you need to install the hooks listed in .pre-commit-config.yaml:

$ pre-commit install

pre-commit will now run on every commit. To manually run all hooks, you can issue

$ pre-commit run --all-files

More information about the yelp pre-commit framework can be found here

IMPORTANT: There's also one repository local hook present in .pre-commit-config.yaml with the name zip_py_scripts. It is responsible for archiving the lambda_xxx.py scripts in the ec2-startstop module. Please make sure this pre-commit hook is run before tagging the repo.

tf-ec2-startstop's People

Contributors

bastiaanvanassche-tomtom avatar bastiaanvanassche avatar

Stargazers

 avatar Tom Hensel avatar

Watchers

James Cloos avatar  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.