SageMaker Processing Job permission denied to save csv file under /opt/ml/processing/

I am working on a project involving Step Functions with SageMaker. I have an existing Step Function that I need to integrate SageMaker into, and I tried adding steps such as processing, model training, registering the model, and batch transform job requests. I also added .sync at the end of each resource so it waits for one to complete before starting the next.

However, I encountered an issue with the Step Function’s SageMaker processing job. The processing job runs but does not finish due to permission being denied to save a CSV file from my processed pandas dataframe.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code># dependencies imports
df = pd.read_csv("/opt/ml/processing/input/data/data.csv")
print(df.head())
# some processing on df
df.to_csv("/opt/ml/processing/output/result.csv", index=False)
</code>
<code># dependencies imports df = pd.read_csv("/opt/ml/processing/input/data/data.csv") print(df.head()) # some processing on df df.to_csv("/opt/ml/processing/output/result.csv", index=False) </code>
# dependencies imports
df = pd.read_csv("/opt/ml/processing/input/data/data.csv")
print(df.head())

# some processing on df

df.to_csv("/opt/ml/processing/output/result.csv", index=False)

Here are my state machine configurations for the processing request:
Please leave me a comment, if you have to see other parts of my configs

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{
"AppSpecification": {
"ContainerEntryPoint": [
"python3",
"/opt/ml/processing/input/code/processing.py"
]
},
"ProcessingInputs": [
{
"InputName": "Input-1",
"S3Input": {
"S3Uri": "s3://my-dataset/data.csv",
"LocalPath": "/opt/ml/processing/input/data"
}
},
{
"InputName": "Input-2",
"S3Input": {
"S3Uri": "s3://my-dataset/processing.py",
"LocalPath": "/opt/ml/processing/input/code"
}
}
],
"ProcessingOutputConfig": {
"Outputs": [
{
"OutputName": "Output-1",
"S3Output": {
"S3Uri": "s3://my-dataset/data.csv",
"LocalPath": "/opt/ml/processing/output/",
"S3UploadMode": "EndOfJob"
}
}
]
}
}
</code>
<code>{ "AppSpecification": { "ContainerEntryPoint": [ "python3", "/opt/ml/processing/input/code/processing.py" ] }, "ProcessingInputs": [ { "InputName": "Input-1", "S3Input": { "S3Uri": "s3://my-dataset/data.csv", "LocalPath": "/opt/ml/processing/input/data" } }, { "InputName": "Input-2", "S3Input": { "S3Uri": "s3://my-dataset/processing.py", "LocalPath": "/opt/ml/processing/input/code" } } ], "ProcessingOutputConfig": { "Outputs": [ { "OutputName": "Output-1", "S3Output": { "S3Uri": "s3://my-dataset/data.csv", "LocalPath": "/opt/ml/processing/output/", "S3UploadMode": "EndOfJob" } } ] } } </code>
{
  "AppSpecification": {
    "ContainerEntryPoint": [
      "python3",
      "/opt/ml/processing/input/code/processing.py"
    ]
  },
  "ProcessingInputs": [
    {
      "InputName": "Input-1",
      "S3Input": {
        "S3Uri": "s3://my-dataset/data.csv",
        "LocalPath": "/opt/ml/processing/input/data"
      }
    },
    {
      "InputName": "Input-2",
      "S3Input": {
        "S3Uri": "s3://my-dataset/processing.py",
        "LocalPath": "/opt/ml/processing/input/code"
      }
    }
  ],
  "ProcessingOutputConfig": {
    "Outputs": [
      {
        "OutputName": "Output-1",
        "S3Output": {
          "S3Uri": "s3://my-dataset/data.csv",
          "LocalPath": "/opt/ml/processing/output/",
          "S3UploadMode": "EndOfJob"
        }
      }
    ]
  }
}

The ProcessingInputs configurations are working as expected. I saw in the log that data.csv content is correctly printed in the log by df.head(). However, when it reaches the last line of code, I get the following error:
PermissionError: Permission Denied '/opt/ml/processing/output/result.csv'
I also tried saving it to other folders as I saw in some examples found online, such as saving to folders like training, result, and others, but no luck so far. It’s giving me the same permission error. I used a Lambda function created just for this and made a request to the SageMaker processing job, and got exactly the same permission denied error.

I also tried saving into completely different folder out of /opt/ml/processing/, but /result.csv
But it gave me different error as SageMaker only allows us to save csv files under /opt/ml/processing/…. so I am not sure what to do with it.

Currently I am saving the result set manually using boto3 api and wait the processing job to pass the StoppingCondition.MaxRuntimeInSecondstime I set and eventually it stops and I use additinoal step to pick it up.
But I dislike the way I make a workaround to the problem and I really need to find a better way to resolve this.

Can someone tell me what I am missing?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật