Skip to content

πŸ”Ž A DNS that look up your aws(ec2), gcp(compute-engine) regardless of multi regions by instance-name or id.🌸

License

Notifications You must be signed in to change notification settings

gjbae1212/cloud-instance-dns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

970994c Β· Jun 20, 2019

History

23 Commits
Jun 20, 2019
Jun 20, 2019
Jun 19, 2019
Jun 20, 2019
Jun 20, 2019
Jun 20, 2019
Jun 19, 2019
Jun 18, 2019
Jun 20, 2019
Jun 19, 2019
Jun 20, 2019

Repository files navigation

cloud-instance-dns

license Go Report Card

OVERVIEW

cloud-instance-dns is DNS server that will look up public or private ip on aws ec2 or gcp compute-engine.
cloud-instance-dns is supporting to search multi regions(zones) instances on clouds(aws,gcp).
In addition it could be searching private or public ip.

HOW TO USE

$ cloud-instance-dns -c your-config-yaml-path

config(yaml)

domain: your-name-server-domain, ex) localhost, dns.example.com, ...  
nameserver: your-machine hostname or public domain(not ip), default) localhost, ex) ec2.compute.amazon.com, ...
port: port-number, ex) 53, ...
email: your-email, ex) gjbae1212@gmail.com ...
prviate: false or true, ex) if you'd like to answer private-ip -> true or public-ip -> false
aws:
  enable: true or false, ex) if your'd use to aws -> true, not -> false
  access_key: your-aws-access-key
  secret_access_key: your-aws-secret-access-key
  regions:
    - your-aws-region-1
    - your-aws-region-2
gcp:
  enable: true or false, ex) if your'd use to gcp -> true, not -> false
  project_id: your-gcp-project-id
  zones:
    - your-gcp-zone-1
    - your-gcp-zone-2
  jwt: your-gcp-jwt-string

usage

You will search to dns records following rule patterns below, Assume having hello.example.com dns

  • (name or instacne-id).hello.example.com will return instances matching name regardless cloud infra.
  • (num).(name or instacne-id).hello.example.com will return a instance matching name and number.
  • (name or instacne-id).aws.hello.example.com will return instances matching name at aws.
  • (num).(name or instacne-id).aws.hello.example.com will return a instance matching name and number at aws.
  • (name or instacne-id).gcp.hello.example.com will return instances matching name at gcp.
  • (num).(name or instacne-id).gcp.hello.example.com will return a instance matching name and number at gcp.
  • (name or instacne-id).rr.hello.example.com will return instances matching name with dns round robin.

build

# your-machine(mac ... and so on)
$ bash local.sh build

# linux
$ bash local.sh linux_build

# homebrew
$ brew tap gjbae1212/cloud-instance-dns
$ brew install cloud-instance-dns

Explanation

If you would be setup to cloud-instance-dns, Be several attention.

AWS

  • aws.enable field of config.yaml must enabled be true.
  • a aws_key must have permission to access ec2(ec2:DescribeInstances).
  • ingress port running cloud-instance-dns must open(port of config.yaml).

GCP

  • gcp.enable field of config.yaml must enabled be true.
  • a gcp-jwt must have permission to access compute-engine(Compute Viewer).
  • ingress port running cloud-instance-dns must open(port of config.yaml).

Configure NS Record

If Your cloud-instance-dns will register global DNS, you must input NS record from your domain.
Assume having example.com and you are running cloud-instance-dns on instance(assume public domain ec2-1.1.1.1.region.compute.amazonaws.com).
And then you will make hello.example.com. DNS.

# your-name-server-domain(domain of your config.yaml)  #TTL          #value(nameserver of your config.yaml)   
hello.example.com.                                     300   IN  NS  ec2-1.1.1.1.region.compute.amazonaws.com 

NS record value must not ip. It is public domain or hostname.

Test

  • dig (name).hello.example.com @localhost --> using localhost dns.
  • dig (name).hello.example.com @ec2-1.1.1.1.region.compute.amazonaws.com --> check A record using your public dns.
  • dig NS hello.example.com --> check NS record using your public dns.

About

πŸ”Ž A DNS that look up your aws(ec2), gcp(compute-engine) regardless of multi regions by instance-name or id.🌸

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published