我正在尝试运行 Spark AWS Glue 作业。
我已将 .py 文件上传到 S3 存储桶,我们将其称为 jobfiles_s3_bucket。
当胶水作业运行时,它会尝试将 .py 从 jobfiles 存储桶复制到临时目录:
S3 Copy Started:
SRC: s3://<insert_bucket_here>/glue-job.py
DEST: /tmp/g-8aa076b857cf7854bfe423a40d5c07863eb091a9-2843067097771260387/script_2024-01-21-00-17-12.py
Specifying ap-southeast-2 while copying script.
S3 copy with region specified failed. Falling back to not specifying region.
我得到这个输出:
fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
Error downloading script: fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
粘合作业具有 IAM 角色,具有以下功能:
{
"Sid" : "AccessPointRWDAccessands3access",
"Effect" : "Allow",
"Action" : [
"s3:*Object",
"s3:Put*",
"s3:List*",
"s3:Get*",
"s3:Delete*"
],
将资源添加到临时目录和作业文件存储桶,但我仍然收到错误?
还有什么可能导致此问题?我不确定还有什么问题吗?
glue 作业应该能够运行 .py 文件,因为它可以访问收集 .py 文件所需的所有 s3 区域,并且拥有运行所需的所有权限。
发布的 IAM 角色看起来有点奇怪。它缺少“资源”部分,例如
Resource": [ ... "arn:aws:s3:::<bucketName>/*" ...]
如果您已允许访问资源,并且已加密存储桶,请确保包含对加密密钥的访问权限。在我看来这两个是最有可能的原因。
有关更多故障排除,您可以参阅官方文档,其中还包括我上面提到的内容。