

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 對已啟用 Spark 的工作群組進行疑難排解
<a name="notebooks-spark-troubleshooting-workgroups"></a>

使用以下資訊，以對 Athena 中已啟用 Spark 的工作群組進行疑難排解。

## 使用現有 IAM 角色時，工作階段會停止回應
<a name="notebooks-spark-troubleshooting-workgroups-existing-role"></a>

如果您沒有為已啟用 Spark 的工作群組建立新的 `AWSAthenaSparkExecutionRole`，而是更新或選擇現有 IAM 角色，則您的工作階段可能會停止回應。在此情況下，您可能需要將下列信任和許可政策新增至已啟用 Spark 的工作群組執行角色。

新增下列信任政策範例。此政策包含執行角色的混淆代理人檢查。以您使用的 `111122223333` `aws-region` `workgroup-name` ID 和工作群組取代 AWS 帳戶 AWS 區域、 和 的值。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "athena.amazonaws.com"
            },
            "Action": "sts:AssumeRole",
            "Condition": {
                "StringEquals": {
                    "aws:SourceAccount": "111122223333"
                },
                "ArnLike": {
                    "aws:SourceArn": "arn:aws:athena:us-east-1:111122223333:workgroup/workgroup-name"
                }
            }
        }
    ]
}
```

------

新增許可政策，如下列已啟用筆記本之工作群組的預設政策。修改預留位置 Amazon S3 位置和 ID，以對應至您正在使用的 Amazon S3 位置和 AWS 帳戶 IDs。將 `amzn-s3-demo-bucket`、`aws-region`、`111122223333` 和 `workgroup-name` 的值取代為您正在使用的 Amazon S3 儲存貯體、 AWS 區域、 AWS 帳戶 ID 和工作群組。

------
#### [ JSON ]

****  

```
{ "Version":"2012-10-17",		 	 	  "Statement": [ { "Effect": "Allow", "Action": [
    "s3:PutObject", "s3:ListBucket", "s3:DeleteObject", "s3:GetObject" ], "Resource": [
        "arn:aws:s3:::amzn-s3-demo-bucket/*",
        "arn:aws:s3:::amzn-s3-demo-bucket" ] }, { "Effect": "Allow",
    "Action": [ "athena:GetWorkGroup", "athena:CreatePresignedNotebookUrl",
    "athena:TerminateSession", "athena:GetSession", "athena:GetSessionStatus",
    "athena:ListSessions", "athena:StartCalculationExecution", "athena:GetCalculationExecutionCode",
    "athena:StopCalculationExecution", "athena:ListCalculationExecutions",
    "athena:GetCalculationExecution", "athena:GetCalculationExecutionStatus",
    "athena:ListExecutors", "athena:ExportNotebook", "athena:UpdateNotebook" ], "Resource":
            "arn:aws:athena:us-east-1:111122223333:workgroup/workgroup-name"
    }, { "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:DescribeLogStreams",
    "logs:CreateLogGroup", "logs:PutLogEvents" ], "Resource": [
            "arn:aws:logs:us-east-1:111122223333:log-group:/aws-athena:*",
            "arn:aws:logs:us-east-1:111122223333:log-group:/aws-athena*:log-stream:*"
    ] }, { "Effect": "Allow", "Action": "logs:DescribeLogGroups", "Resource":
            "arn:aws:logs:us-east-1:111122223333:log-group:*"
    }, { "Effect": "Allow", "Action": [ "cloudwatch:PutMetricData" ], "Resource": "*", "Condition":
    { "StringEquals": { "cloudwatch:namespace": "AmazonAthenaForApacheSpark" } } } ] }
```

------