Forked from mvanholsteijn/update-all-route53-domains-contacts.py
Created
April 23, 2022 13:36
-
-
Save ericpardee/a332cfb79ad9cc7d0164eec364028d6a to your computer and use it in GitHub Desktop.
update the contacts of all route53 registered domains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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