未显示使用 CloudFormation 创建的 EMR 集群

EMR cluster created with CloudFormation not shown

我已将 EMR 集群添加到堆栈中。成功更新堆栈 (CloudFormation) 后,我可以在 EC2 控制台中看到主节点和从节点,并且可以通过 SSH 连接到主节点。但是 AWS 控制台不显示新集群。即使 aws emr list-clusters 也不显示集群。我对该区域进行了三重检查,我确信我正在查看正确的区域。

相关 CloudFormation JSON:

"Spark01EmrCluster": {
  "Type": "AWS::EMR::Cluster",
  "Properties": {
    "Name": "Spark01EmrCluster",
    "Applications": [
      {
        "Name": "Spark"
      },
      {
        "Name": "Ganglia"
      },
      {
        "Name": "Zeppelin"
      }
    ],
    "Instances": {
      "Ec2KeyName": {"Ref": "KeyName"},
      "Ec2SubnetId": {"Ref": "PublicSubnetId"},
      "MasterInstanceGroup": {
        "InstanceCount": 1,
        "InstanceType": "m4.large",
        "Name": "Master"
      },
      "CoreInstanceGroup": {
        "InstanceCount": 1,
        "InstanceType": "m4.large",
        "Name": "Core"
      }
    },
    "Configurations": [
      {
        "Classification": "spark-env",
        "Configurations": [
          {
            "Classification": "export",
            "ConfigurationProperties": {
              "PYSPARK_PYTHON": "/usr/bin/python3"
            }
          }
        ]
      }
    ],
    "BootstrapActions": [
      {
        "Name": "InstallPipPackages",
        "ScriptBootstrapAction": {
          "Path": "[S3 PATH]"
        }
      }
    ],
    "JobFlowRole": {"Ref": "Spark01InstanceProfile"},
    "ServiceRole": "MyStackEmrDefaultRole",
    "ReleaseLabel": "emr-5.13.0"
  }
}

原因是缺少 VisibleToAllUsers 属性,默认为 false。由于我使用的是 AWS Vault(即使用 STS AssumeRole API 进行身份验证),我基本上每次都是不同的用户,所以我看不到集群。我无法更新堆栈以添加 VisibleToAllUsers,因为我得到 Job flow ID does not exist

解决方案是以 root 用户身份登录并从那里修复问题(我不得不手动删除集群,但将其从堆栈模板中删除 JSON 并更新堆栈可能会奏效,如果我没有已经把事情搞砸了)。

然后我将集群添加回模板(VisibleToAllUsers 设置为 true)并照常更新堆栈 (AWS Vault)。