This shell script further automates the process of generating a DNS zone file, and optionally, pushing it to Route 53.
It requires that you have a GitHub repository, like this, with all of your DNS records in a file named zone-file-generator.php
. The repo can be public or private (assuming you have access).
domain
- the domain the zone file is being generated for. This must be a fully qualified domain name that ends with a period (i.e.example.com.
)github_repo
- the GitHub repository that contains yourzone-file-generator.php
file (i.e.github-username/github-repo-name
)argX
(optional) - you can pass up to 32 custom arguments tozone-file-generator.php
. These will be accessible in PHP using the$argv[]
array (indexes 3-34), and the values can be pretty much whatever you want. This feature is useful when the output of yourzone-file-generator.php
script is dynamic
#!/bin/sh
curl https://raw.githubusercontent.com/evan-klein/zone-file/master/generate-zone-file.sh > ~/generate-zone-file.sh
sh ~/generate-zone-file.sh example.com. github-username/github-repo-name
rm ~/generate-zone-file.sh
#!/bin/sh
curl https://raw.githubusercontent.com/evan-klein/zone-file/master/generate-zone-file.sh > ~/generate-zone-file.sh
sh ~/generate-zone-file.sh example.com. github-username/github-repo-name www1 node5
rm ~/generate-zone-file.sh