lambda-lb-target-group-dns

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 12 Imported by: 0

README

lambda-lb-target-group-dns

GitHub Snapshot Release Trunk Check Docker Image Version Amazon ECR Image Version

AWS Lambda which registers IP addresses to the LB Target Group based on DNS record.

Usage

Copy the container to your private ECR and use it as the container image or copy ZIP distribution and use it with an Amazon Linux 2023 runtime.

Lambda accepts parameters:

{
  "targetGroupArn": "arn:aws:elasticloadbalancing:REGION:ACCOUNTID:targetgroup/TARGETGROUP/NNN",
  "domainName": "XXX.gr7.REGION.eks.amazonaws.com",
  "targetPort": 0
}

Lambda returns the status:

{
  "status": "OK"
}

You can test it as a standalone tool as:

lambda-lb-target-group-dns -target-group-arn XXX -domain-name XXX -target-port NNN
Container image

Copy the container to your private ECR:

From DockerHub:

docker pull dex4er/lambda-lb-target-group-dns:TAG
docker tag dex4er/lambda-lb-target-group-dns:TAG ACCOUNTID.dkr.ecr.REGION.amazonaws.com/dex4er/lambda-lb-target-group-dns:TAG
docker push ACCOUNTID.dkr.ecr.REGION.amazonaws.com/dex4er/lambda-lb-target-group-dns:TAG

or from Amazon ECR Public:

docker pull public.ecr.aws/dex4er/lambda-lb-target-group-dns:TAG
docker tag public.ecr.aws/dex4er/lambda-lb-target-group-dns:TAG ACCOUNTID.dkr.ecr.REGION.amazonaws.com/dex4er/lambda-lb-target-group-dns:TAG
docker push ACCOUNTID.dkr.ecr.REGION.amazonaws.com/dex4er/lambda-lb-target-group-dns:TAG

Supported tags:

  • vX.Y.Z-linux-amd64
  • vX.Y.Z-linux-arm64
  • vX.Y.Z
  • vX.Y
  • vX
  • latest

IAM

This lambda function needs the following permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "elasticloadbalancing:DescribeTargetGroups",
        "elasticloadbalancing:DescribeTargetHealth"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "elasticloadbalancing:DeregisterTargets",
        "elasticloadbalancing:RegisterTargets"
      ],
      "Resource": "arn:aws:elasticloadbalancing:REGION:ACCOUNTID:targetgroup/NAME/NNN"
    }
  ]
}

Example

See example/terraform directory for an example how to use this lambda function.

License

The MIT License (MIT)

Copyright (c) 2024 Piotr Roszatycki piotr.roszatycki@gmail.com

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL