本文整理匯總了Python中boto.emr.connection.EmrConnection.list_instances方法的典型用法代碼示例。如果您正苦於以下問題:Python EmrConnection.list_instances方法的具體用法?Python EmrConnection.list_instances怎麽用?Python EmrConnection.list_instances使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類boto.emr.connection.EmrConnection
的用法示例。
在下文中一共展示了EmrConnection.list_instances方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_internal_ips_from_emr
# 需要導入模塊: from boto.emr.connection import EmrConnection [as 別名]
# 或者: from boto.emr.connection.EmrConnection import list_instances [as 別名]
def get_internal_ips_from_emr(cluster_id, cr):
"""
Retrieves a list of internal IP addresses for a given EMR cluster
"""
# Open connection to EMR
conn = EmrConnection(
cr.get_config("aws_access_key"),
cr.get_config("aws_secret_key"),
region = RegionInfo(name = cr.get_config("aws_region"),
endpoint = cr.get_config("aws_region") + ".elasticmapreduce.amazonaws.com" ))
# Build list of internal ips from list_instances EMR API
emr_internal_ips = []
emr_instances = conn.list_instances(cluster_id).instances
for instance in emr_instances:
emr_internal_ips.append(instance.privateipaddress)
return emr_internal_ips