GithubHelp home page GithubHelp logo

gpkfr / terraform-aws-populate_nlb_tg_with_rds Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neillturner/terraform-aws-populate_nlb_tg_with_rds

0.0 1.0 0.0 475 KB

populate network load balancer target group with RDS IP address. This can be in fact any DNS resolvable to an instance like redshift DNS.

License: Apache License 2.0

HCL 0.65% Python 99.35%

terraform-aws-populate_nlb_tg_with_rds's Introduction

terraform-aws-populate_nlb_tg_with_rds

Populate network load balancer target group with RDS IP address. This can be in fact any DNS resolvable to an instance like redshift DNS.

Overview

RDS database have a DNS such as my-db.ctjuxtulczykq.eu-west-1.rds.amazonaws.com that assciates an IP Address so applications can connect to the database. However the IP Address is subject to change in case of failover or upgrade so putting a load balancer in front (i.e. to use privatelink ) is problematic as the IP address must be specified in the target group. This lambda runs regularly to check the IP Address of the DNS entry for the RDS database and will unregister the old IP address and register the new IP address in the target group if it is changed.

Initially it doesn't have any code to re-attemp the registration is if the connection goes into an Error state.

Requirements

This module requires Terraform version 0.14.x or newer.

Dependencies

This module depends on a correctly configured AWS Provider in your Terraform codebase.

Usage

module "populate_nlb_tg_with_rds" {
  source = "neillturner/populate_nlb_tg_with_rds/aws"
  version = "0.x.0"
  rds_dns_name = "my-db.ctjuxtulczykq.eu-west-1.rds.amazonaws.com"
  nlb_tg_arn = "arn:aws:elasticloadbalancing:eu-west-1:01234567890:targetgroup/mytargetgroup/aabbccddee0044332211"
  max_lookup_per_invocation = "10" 
}

variables

rds_dns_name

The DNS name of the RDS database. This can be in fact any DNS resolvable to an instance like redshift DNS.

nlb_tg_arn

Network Log Balancer Target Group arn.

max_lookup_per_invocation

Maximum number of invocations of DNS lookup.

Note: This is a string value even though it is a number as it sets an environment variable

schedule_expression

The aws cloudwatch event rule schedule expression that specifies when the lambda runs.

Default = "rate(5 minutes)" i.e. every "rate(5 minutes)" See ScheduledEvents

resource_name_prefix

The prefix to apply to resource names. E.g. setting this to cluster1- will create the Lambda as cluster1-populate-nlb-tg-with-rds-lambda rather than populate-nlb-tg-with-rds-lambda. default = "".

References

https://aws.amazon.com/blogs/networking-and-content-delivery/using-static-ip-addresses-for-application-load-balancers/

https://aws.amazon.com/blogs/networking-and-content-delivery/hostname-as-target-for-network-load-balancers/

https://www.bluematador.com/blog/static-ips-for-aws-application-load-balancer

terraform-aws-populate_nlb_tg_with_rds's People

Contributors

neillturner avatar

Watchers

 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.