Git Product home page Git Product logo

terraform-aws-autoscaling's Introduction

Terraform AWS Autoscaling

๐Ÿ“ Naming Convention

Common variables referenced in naming standards

Variable RegExp Example
<availability_zone> [a-z]{2}-[a-z]{1,}-[1-2][a-f] us-east-1a, us-west-2c, eu-west-1a, ap-northeast-1c

๐Ÿ“ AWS - Resource Naming Standards

  • ALB
AWS Resource Resource Naming Comment Example
ALB <app_name>-alb-private Tag Tier = private web-api-alb-private
<app_name>-alb-public Tag Tier = public web-api-alb-public
ALB Target group <app_name>-<protocol> web-api-alb-http, web-api-alb-https
ALB Security Groups <app_name>-alb web-api-alb
  • ASG
AWS Resource Resource Naming Comment Example
ASG Security Groups <app_name> web-api
ASG Launch Config <app_name>-lc-<timestamp> web-api-lc-1537774225

๐Ÿ”ฎ Terraform Discovery module

If you followed the naming conventions listed in terraform-aws-vpc you will find it useful to use this terraform-aws-discovery module. The idea of using a discovery module is to centralize datasource usage in a central place and keep the source code DRY.

Here is an example usage:

module "discovery" {
  source              = "github.com/Lowess/terraform-aws-discovery"
  aws_region          = "${var.aws_region}"
  vpc_name            = "${var.vpc_nameโˆ‘}"
  ec2_ami_names       = [...]
  ec2_security_groups = [...]
}

โ˜๏ธ If you do not what to use this module you are free to redefine the datasources you need but keep in mind that you will be rebuilding the wheel ๐ŸŽก

1. Create an ALB

Let's create an ALB and the related resources needed (security groups, listeners and target groups).

ALB

2. Create the Autoscaling group- ':house: In House' way

โ˜๏ธ AWS Educate does not allow access to Autoscaling and Launch configuration services, In this example we will simulate autoscaling features by running multiple EC2 instances

ALB & ASG

3. Add monitoring and create an Autoscaling script - ':house: In House' way

๐Ÿ’ช It's now on you to figure out a logic to implement scale up / scale down actions on your autoscaling group

โ˜๏ธ Here is a way to retrieve Netdata CPU average using the Netdata API:

curl -s "http://<instance-ip>:19999/api/v1/data?chart=system.cpu&after=-10&format=json&options=nonzero" \
  | jq "[ .data[] | nth(2)] | add / length";

ALB & ASG & Monitoring

Based on standard module structure guidelines

terraform-aws-autoscaling's People

Contributors

lowess avatar

Watchers

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