Coder Social home page Coder Social logo

ugurcemozturk / aws-asg-auto-dns Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 13 KB

Fully featured terraform template to auto update DNS records with AWS Auto Scaling Group instances by round-robin DNS, aka Route53 Multi Value Answer Policy

HCL 74.12% Python 25.88%
aws autoscale route route53 terraform lambda

aws-asg-auto-dns's Introduction

It's highly recommended to use AWS managed or custom load balancer. This implementation relies on the Route53 MultiValueAnswer policy.

Description

This terraform template creates an AWS Auto Scaling Group with network based scaling policy and their CloudWatch alarms among with auto DNS updates on instance start and terminate by sending notifications from Auto Scaling Group lifecycle hooks to SNS. This SNS notifications trigger python based lambda functions to update your DNS entities hosted in Route53

Best practice?

This implementation may cover your needs when you cannot work with a load balancer due to specific network protocols or such. It applies DNS round-robin by using Route53 MultiValueAnswer policy.

Requirements

You have to edit variables.tfvars, especially the ones with your-### such as AMI name, VPC name, etc.

What's being provisioned?

  • It deploys to your default VPC in eu-central-1 region which can be configured in variables.tfvars
  • An Auto Scaling Group with 2 desired instances with the launch template defined below
  • A launch template with the most recent Amazon Linux 2 AMI; amzn2-ami-hvm*
  • 2 scaling policy and cloudwatch alarms that trigger based on networkOut metric of the ASG instances.
  • 2 CloudWatch log groups for lambdas with 30 days of retention
  • A security group with one TCP ingress, the ingress port defined as a terraform variable.
  • 2 Lambda functions to register and deregister DNS
  • 2 SNS topics to trigger register and deregister Lamdas
  • An IAM role for lambda funciton to let them update the DNS (!! This is shitty, it uses AdministratorPolicy and needs to be updated by least privillaged scope !!)
  • It's not using S3 or any other backend as a state management for the sake of the POC.

Todo

  • Replace Admin level policy
  • Estimated cost
  • Add architecture diagram
  • Lamda layers-
  • Add license

aws-asg-auto-dns's People

Contributors

ugurcemozturk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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