Populate network load balancer target group with RDS IP address. This can be in fact any DNS resolvable to an instance like redshift DNS.
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.
This module requires Terraform version 0.14.x
or newer.
This module depends on a correctly configured AWS Provider in your Terraform codebase.
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"
}
The DNS name of the RDS database. This can be in fact any DNS resolvable to an instance like redshift DNS.
Network Log Balancer Target Group arn.
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
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
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 = "".
https://www.bluematador.com/blog/static-ips-for-aws-application-load-balancer