Skip to content

Instantly share code, notes, and snippets.

@mvanholsteijn
Created February 10, 2020 14:48
Show Gist options
  • Save mvanholsteijn/2de495ff6d2b0a740361f240d7548b33 to your computer and use it in GitHub Desktop.
Save mvanholsteijn/2de495ff6d2b0a740361f240d7548b33 to your computer and use it in GitHub Desktop.
update the contacts of all route53 registered domains
import boto3
import json
contact = {
"FirstName": "Mark",
"LastName": "van Holsteijn",
"ContactType": "COMPANY",
"AddressLine1": "Laapersveld 27",
"City": "Hilversum",
"CountryCode": "NL",
"ZipCode": "1213 VB",
"PhoneNumber": "+31.355381921",
"Email": "[email protected]",
}
d = boto3.client("route53domains", region_name="us-east-1")
paginator = d.get_paginator("list_domains")
for response in paginator.paginate():
for domain in response["Domains"]:
name = domain["DomainName"]
detail = d.get_domain_detail(DomainName=name)
print(f'{name} {detail["AdminContact"]}')
print(f"updating contacts for {name}")
try:
update_response = d.update_domain_contact(
DomainName=name,
AdminContact=contact,
RegistrantContact=contact,
TechContact=contact,
)
except Exception as e:
print(f"failed, {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment