import dns.resolver import dns.query def lambda_handler(event, context): res = dns.resolver.Resolver() res.timeout = 5 res.lifetime = 30 res.nameservers = ['10.135.6.95','10.135.6.96'] results = res.query('_ldap._tcp.hkg.yourdomain.com', 'SRV', tcp=True) print('_ldap._tcp.hkg.yourdomain.com:') for line in results: print(line.to_text()) results = res.query('_kerberos._tcp.hkg.yourdomain.com', 'SRV', tcp=True) print('_kerberos._tcp.hkg.yourdomain.com:') for line in results: print(line.to_text()) return {}