I haven't tested whether this code will run on SageMaker without the get_execution_role() line. It's been some time since I wrote this tutorial. Looking at the source code for this method in the SageMaker Python SDK, one can see that it forces the instantiation of a boto3 session object:
https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/session.py#L5029
When this session object is created, I believe it will inherit the configuration of the instance profile attached to the SageMaker instance. Subsequent calls made using the boto3 library should then be part of the same session. No need to pass in IAM credentials.
If you were using the SageMaker notebook to spawn training jobs outside the notebook, you would want to pass the role ARN to them, which is the other thing this method is useful for.
Of course, I could be mistaken in these assumptions. If I am, hopefully someone will correct me.
Thanks for asking this thoughtful question.