10000 GitHub - rhythmictech/aws-lambda-ddns-function: Dynamically create Route 53 resource records using CloudWatch Events and Lambda
[go: up one dir, main page]

Skip to content

Dynamically create Route 53 resource records using CloudWatch Events and Lambda

License

Notifications You must be signed in to change notification settings

rhythmictech/aws-lambda-ddns-function

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EC2 Instance Dynamic DNS registration

Introduction

When using central authentication and other nice things in life, it can be valuable to have consistent forward/reverse DNS across various AWS accounts, but letting instances register themselves in Route 53 is generally not ideal. Using things like Puppet or Ansible to do the same typically results in stale records over time, plus takes what should be a provisioning task and converts it into a configuration task.

This project uses CloudWatch Events and a Lambda function to detect instance creation/deletion and manage corresponding Route 53 records on your behalf. This is all driven through CloudFormation, which makes it easy to set up.

The forward hostname is computed based on the tag MACHINE_NAME or the AWS-computed privateDNSName and the domain name specified in the DHCP option set. The privateDNSName is simply based on the IP address and gives you functional matching forward/reverse DNS but not a useful name to address your machine. The MACHINE_NAME tag lets you conveniently address the instances you wish to access via a friendly name. The Name tag was not used because not everyone uses that tag for that purpose.

Requirements

You need the following:

  • VPC with DNS resolution and hostnames enabled
  • DHCP Option Set that includes a domain name, corresponding to a private zone in Route 53.
  • S3 bucket to hold your CFN templates and Lambda code (does not need to be a dedicated bucket)
  • Latest AWS CLI installed to create various things

That's about it.

Installation

The project can be driven through make.

Customize the Makefile S3 parameters to fit your environment.

To create:

make upload-template upload-lambda create-stack

To update the function code:

make upload-lambda update-lambda

Notes

This project was forked from the AWS Labs GitHub repo, which presented a slightly different approach. This implementation allows the hostname to be specified via a tag and eliminates the confusing CNAME nomenclature, which can confuse central authentication mechanisms like Kerberos that expect the client and the server to agree on the FQDN.

About

Dynamically create Route 53 resource records using CloudWatch Events and Lambda

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.1%
  • Makefile 7.9%
0