Search code examples
aws-glue

CommandFailedException when running Glue ETL Job


When I try to run my Glue ETL Job, I get the following error:

CommandFailedException: Script file doesn't exist s3://my-bucket/my-script.py

I double-checked the path, and it is correct. I can see the script source code on the Glue Job in the AWS Console.

How can I resolve this issue?


Solution

  • This error message can be caused by an IAM permissions issue. Make sure the IAM role on the Glue Job has a policy that allows it to read from the S3 bucket where the script file is stored. For example:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "s3:GetObject",
            "s3:ListBucket",
            "s3:ListObjects"
          ],
          "Resource": [
            "arn:aws:s3:::my-bucket",
            "arn:aws:s3:::my-bucket/*"
          ]
        }
      ]
    }