Skip to content

Instantly share code, notes, and snippets.

@lordjabez
Created December 15, 2024 03:19
Show Gist options
  • Save lordjabez/01a3ecb127ea8da0920dc6058fb4d1e3 to your computer and use it in GitHub Desktop.
Save lordjabez/01a3ecb127ea8da0920dc6058fb4d1e3 to your computer and use it in GitHub Desktop.
Bulk update domains in Route 53
#!/usr/bin/env python3
import boto3
import time
route53_client= boto3.client('route53domains')
response = route53_client.list_domains(MaxItems=100)
domains = response['Domains']
domain_names = [d['DomainName'] for d in domains]
contact_names = ('AdminContact', 'BillingContact', 'RegistrantContact', 'TechContact')
def update_contact(contact):
contact['FirstName'] = 'TODO'
contact['LastName'] = 'TODO'
contact['PhoneNumber'] = 'TODO'
for domain_name in domain_names:
time.sleep(1)
response = route53_client.get_domain_detail(DomainName=domain_name)
params = {'DomainName': domain_name}
for contact_name in contact_names:
update_contact(response[contact_name])
params[contact_name] = response[contact_name]
response = route53_client.update_domain_contact(**params)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment