创建集群需要 InstanceProfile - 创建 python 函数来安装模块

InstanceProfile is required for creating cluster - create python function to install module

我正在使用带有 boto 的弹性 mapreduce。

一切正常,但自本周以来我收到此错误:

InstanceProfile is required for creating cluster

我正在尝试解决这个问题,现在看来我们需要为 elastic map reduce 创建一个默认角色。

我是使用 awscli 和下面的命令完成的,但是没有其他方法可以做到这一点(例如使用 boto)吗?

如果没有其他方法可以创建一个 python 函数来执行下面这 3 个命令?

1 - pip 安装 awscli

2 - aws 配置

3 - aws emr create-default-roles

在上面使用这个命令后,我还需要在 mapreduce 作业函数中添加这个:

ami_version="2.4.9",
job_flow_role="EMR_EC2_DefaultRole",
service_role="EMR_DefaultRole"

为 EMR 创建角色(例如,默认角色)只需为每个区域的每个账户创建一次。这不是需要定期执行的步骤。如果您想通过 boto 创建角色,可以使用 IAM API (http://boto.readthedocs.org/en/latest/ref/iam.html) and build the roles in accordance with the default policies as defined at http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-iam-roles-defaultroles.html

运行 aws emr create-default-roles 在发出 aws emr create-cluster 命令之前为集群创建默认角色。