sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

Which permissions are needed to allow us to use the NetworkConfig for processing Jobs?

Open JimFawkes opened this issue 4 years ago • 2 comments

Since there was no activity in the discussions, I move this here in the hopes of some input.

Discussed in https://github.com/aws/sagemaker-python-sdk/discussions/2912

Originally posted by JimFawkes February 8, 2022 We would like to run a SM processing Job in our own VPC & Security Group. We assume that that is what the `NetworkConfig is setting is for. Unfortunately we are running into a rather unhelpful error:

UnexpectedStatusException: Error for Processing job test-job-2022-02-08-16-14-38-489: Failed. Reason: InternalServerError: We encountered an internal error.  Please try again.

The following code produces the error:

import boto3
from sagemaker import Session
from sagemaker.sklearn.processing import ScriptProcessor
from sagemaker.network import NetworkConfig


sm = boto3.client("sagemaker")

session = Session(default_bucket="our-s3-bucket-name", sagemaker_client=sm)

networking = NetworkConfig(
    security_group_ids=["sg-12345"],
    subnets=["subnet-123345"]
)

script_processor = ScriptProcessor(
    command=["python3"],
    image_uri="12345.dkr.ecr.eu-west-1.amazonaws.com/abc/efg",
    role="arn:aws:iam::12345:role/custom-service-role",
    instance_count=1,
    instance_type="ml.m5.large",
    base_job_name="test-job",
    sagemaker_session=session,
    env=env_vars,
    network_config=networking
)

 script_processor.run(
        code=script_location,
)

We assumed that the error is due to a missing permission in the sagemaker service role we pass to the job but could not figure out which it is.

Any tips to help us debug the error are greatly appreciated.

JimFawkes avatar Mar 24 '22 12:03 JimFawkes

We have the same issue, where we cannot run a SparkProcessor job in our own VPC and Security Group and receive this same error with no logs on the job. What permissions are required on the sagemaker service role?

sowston avatar Apr 25 '22 17:04 sowston

Closing as stale. The InternalServerError returned when a processing job is launched with a NetworkConfig is raised by the SageMaker service, and the question here is about the IAM and VPC permissions the execution role and networking need (subnets with a route to S3/ECR, security group rules, and so on). The SDK only passes the NetworkConfig values through to the CreateProcessingJob request. That kind of account and networking question is best handled through AWS Support or re:Post, where the service-side logs can be inspected. If you find an SDK-side defect in how NetworkConfig is serialized on V3 (sagemaker 3.x), please open a new issue with the request that was sent.

jam-jee avatar Sep 14 '26 20:09 jam-jee