Automatic Route53 updates based on EC2 Autoscaling state changes
auto53
solves the issue of keeping a route53 zone up to date with the changes that an autoscaling group might face.
For instance, consider the following state in EC2:
# internal state retrieved from the
# inspection of EC2
autoscaling_groups:
- name: asg1
instances:
- id: 'i-0123'
private_ip: '10.0.0.2'
- id: 'i-0321'
private_ip: '10.0.0.3'
and also the following formatting configuration:
# for each zone we can tie several
# autoscaling groups that present
# an automatic record creation rule.
---
- AutoScalingGroup: 'asg1'
Zone':
ID: 'zone123'
Name: 'ciro-test'
Record: 'asg1-machines'
- AutoScalingGroup: 'asg1'
Zone':
ID: 'zone123'
Name: 'ciro-test'
Record: '{{ .Id }}-machine'
with that we'd end up with the following records:
asg1-machines.ciro-test:
- 10.0.0.2
- 10.0.0.3
i-0123-machine.ciro-test:
- 10.0.0.2
i-0321-machine.ciro-test:
- 10.0.0.3
Now we could consider the situation where asg1
scales out to 3
instances while at the same time having the death of i-0321
:
autoscaling_groups:
asg1:
machines:
- id: 'i-0123'
private_ip: '10.0.0.2'
- - id: 'i-0321'
- private_ip: '10.0.0.3'
+ - id: 'i-0444'
+ private_ip: '10.0.0.4'
+ - id: 'i-0555'
+ private_ip: '10.0.0.5'
That would mean that auto53
would notice the change in the desired state and then update route53
accordingly:
asg1-machines.ciro-test:
- 10.0.0.2
- 10.0.0.4
- 10.0.0.5
i-0123-machine.ciro-test:
- 10.0.0.2
i-0444-machine.ciro-test:
- 10.0.0.4
i-0555-machine.ciro-test:
- 10.0.0.5
auto53
aims at being a single binary that is capable of running in 2 modes:
In either case, the necessary user permissions are needed:
The AWS credentials are accessed via the default behavior of AWS CLI (either environment variables or config file under ~/.aws
).
Usage: auto53 [opts ...]
Options:
--config CONFIG [default: ./auto53.yaml]
--debug activates debug-level logging
--dry run without performing modifications
--interval INTERVAL [default: 2m0s]
--listen
--once run one time and exit
--port PORT [default: 8080]
--help, -h display this help and exit