-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaws_hostedzone_create.py
36 lines (34 loc) · 1.14 KB
/
aws_hostedzone_create.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3.8
import boto3
import datetime
import os
def createzone(zonename):
try:
client = boto3.client("route53")
response = client.create_hosted_zone(
Name='airtickets.co.nz',
CallerReference= 'test04',
HostedZoneConfig={
'Comment': 'Migrated from UltraDNS',
'PrivateZone': False
},
#{
# "NameServers": [
# "ns-156.awsdns-19.com",
# "ns-1620.awsdns-10.co.uk",
# "ns-836.awsdns-40.net",
# "ns-1183.awsdns-19.org"
# ],
# "CallerReference": "HLO01",
# "Id": "/delegationset/N081177417MRLQL7STVKJ"
# }
DelegationSetId='N081177417MRLQL7STVKJ'
)
print(response)
print("Importing Zone file...\n")
command = "cli53 import --file zonefile/" + zonename + ".txt " + zonename
#print(command)
stream = os.popen(command)
output = stream.read()
print(output)
except Exception as e: print(e)