You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PySparkProcessor Uses Local Role Instead of Passed Role For Initial S3 File Movement #1988
Describe the bug
PySparkProcessor uses the role used to call it when using the sagemaker SDK when it attempts to load local submit_files to S3 instead of using the role passed into it. The normal ScriptProcessor seems to use the passed in role. I got an access denied the first time I used PySparkProcessor when my calling role and passed in role were different.
To reproduce
Create a PySparkProcessor and run it with a different role than the role passed into the instantiation. If the calling role doesn't have S3 permissions on sagemaker you will get an access denied even if the passed-in role does have sagemaker S3 permissions. I added "Resource": "arn:aws:s3:::*sagemaker*" to my calling role to get passed this.
Expected behavior
PySparkProcessor would use the passed in role to upload the local files to S3.
Screenshots or logs
Normal access denied error.
System information
A description of your system. Please provide:
SageMaker Python SDK version: 2.16.2
Framework name (eg. PyTorch) or algorithm (eg. KMeans): PySparkProcessor
Framework version: Unknown
Python version: 3.7
CPU or GPU: CPU
Custom Docker image (Y/N): Yes but just using sagemakerk==2.16.2
@jimmycfa The SDK doesn't use the role passed in the Processor locally by design. The role parameter is passed to SageMaker service to start training jobs, processing jobs etc. Locally SDK caller could have different way to setup their credential, whatever local credential is used may not have permission to assumed the role specified in the parameter.
We do have a get_execution_role here you can use to get the role name you are running the sdk code with -
Then you can pass that to the Processor constructor if desired. This is pattern in a lot of our example notebooks. Hope this answers your question. Resolving the issue. Feel free to reopen if you have any follow up questions.
Activity
icywang86rui commentedon Nov 18, 2020
@jimmycfa The SDK doesn't use the role passed in the Processor locally by design. The role parameter is passed to SageMaker service to start training jobs, processing jobs etc. Locally SDK caller could have different way to setup their credential, whatever local credential is used may not have permission to assumed the role specified in the parameter.
We do have a get_execution_role here you can use to get the role name you are running the sdk code with -
sagemaker-python-sdk/src/sagemaker/session.py
Line 3627 in f43ff06
Then you can pass that to the Processor constructor if desired. This is pattern in a lot of our example notebooks. Hope this answers your question. Resolving the issue. Feel free to reopen if you have any follow up questions.
MTRL Launch PR (#5919)
MTRL Launch PR (aws#5919)