def create_cname(args):
conn = boto.route53.connect_to_region(args['--region'])
zone = conn.get_zone(args['<zone>'])
name = args['<name>']
status = zone.add_cname(name, args['<value>'], ttl=args['--ttl'])
print("waiting for record to sync: {}".format(status))
while status.update() != "INSYNC":
time.sleep(2)
print(status)
print('waiting for wildcard domain to become available...', end='')
# AWS docs say it can take up to 30 minutes for route53 changes to happen, although
# it seems to be almost immediate.
for i in xrange(120):
try:
random_hostname = str(uuid.uuid4())[:8]
if socket.gethostbyname("{}.{}".format(random_hostname, name)):
print('ok')
break
except socket.gaierror:
time.sleep(15)
评论列表
文章目录