Skip to content

Instantly share code, notes, and snippets.

@zircote
Created July 16, 2014 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zircote/338452dddbaa8590bc03 to your computer and use it in GitHub Desktop.
Save zircote/338452dddbaa8590bc03 to your computer and use it in GitHub Desktop.
from boto import route53
r53 = route53.connect_to_region(region_name='us-east-1')
dev_aws = r53.get_zone('my-domain.local')
with open('hosts') as host:
i = 0
rrs = route53.record.ResourceRecordSets(r53, dev_aws.id)
for line in host.readlines():
line = line.strip()
parts = line.split(',')
c = rrs.add_change("UPSERT", parts[1], "A")
c.add_value(parts[0])
if i >= 3999:
rrs.commit()
rrs = route53.record.ResourceRecordSets(r53, dev_aws.id)
i = 0
i += 1
rrs.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment