本文整理汇总了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