为什么 EMR Notebook 在以 AWS 账户所有者身份运行时无法连接到其集群

mhe*_*zog 6 amazon-emr

我已使用默认设置创建了 AWS EMR 集群和笔记本。

当我打开笔记本时,内核不会启动。我收到消息“工作区未附加到集群”。

  • 集群处于“就绪”状态。
  • 所有内核均无法工作(Python、Spark、PySpark)。
  • 使用 Jupyter Labs 或 Jupyter 都会发生该错误。
  • 我切换到另一个从未运行过 EMR 的 AWS 账户并创建了一个笔记本。我请求创建一个集群。AWS启动了一个集群,但当我启动笔记本时出现了同样的错误。

线索

我查看了笔记本发生故障的集群创建的日志文件。

在日志文件中https://aws-logs-***.s3.amazonaws.com/elasticmapreduce/j-3SOK08VFSQDPO/node/i-04af0a3d2d6d96cac/daemons/emr-on-cluster-env/gateway.log.gz,我发现以下内容:

Jupyter Enterprise Gateway 2.1.0 is available at http://127.0.0.1:9547
User 'root' is not authorized to start kernel 'Python 3'. Ensure KERNEL_USERNAME is set to an appropriate value and retry the request.
User 'root' is not authorized to start kernel 'PySpark'. Ensure KERNEL_USERNAME is set to an appropriate value and retry the request.
Run Code Online (Sandbox Code Playgroud)

我如何让笔记本内核工作

根据 Stackoverflow 帖子Notebooks on EMR (AWS): Failed to start kernel,我从使用根 AWS 账户切换到IAM 用户。这适用于 EMR 6.5.0。

我的问题

当我使用 IAM 账户启动集群时发生了什么变化?我怎么知道使用 root 用户是问题所在?

EMR 对我来说是一个黑匣子。预先感谢您帮助我了解这项令人惊叹的技术的内部运作原理。

bio*_*man 3

这是关键问题:

User 'root' is not authorized to start kernel 'Python 3'. Ensure KERNEL_USERNAME is set to an appropriate value and retry the request.
User 'root' is not authorized to start kernel 'PySpark'. Ensure KERNEL_USERNAME is set to an appropriate value and retry the request.
Run Code Online (Sandbox Code Playgroud)

您需要创建一个具有 EMR 权限的普通 IAM 帐户,使用该用户登录,然后从那里启动笔记本。您的主 AWS 账户是根账户。我与 AWS 支持人员联系并让我的笔记本以这种方式运行。