In Lab 4, you tested out a remediating detective control that is triggered when a SageMaker training job is launched outside of the VPC. But waiting minutes to find out that your training job is going to error out is not a great experience for the data scientists. In this lab, you will implement a preventive control that will prevent a training job from starting if it’s not launched within a VPC. In the interest of defence in depth we will now implement the preventive control to complement the detective control exercised in the previous lab.
To deploy a preventive control, assume the role of the Data Science Administrator and create a new version of the Data Science Project SageMaker Notebook, updating it with one of the CloudFormation templates referenced below in Amazon S3.
Administrationon the left-hand navigation bar.
Create new version.
Use a CloudFormation Template
Version 2for the
Create product version.
Update provisioned product
Version 2and click
Updateand wait for the notebook’s permissions to be updated.
N. Virginia (us-east-1)
After the product has been successfully updated resume the role of Data Scientist and revist the Jupyter notebook kernel and execute the cell titled Train Without VPC Configured. You should now quickly receive an Access Denied exception similar to the below:
ClientError: An error occurred (AccessDeniedException) when calling the CreateTrainingJob operation: User: arn:aws:sts::012348485732:assumed-role/SageMakerExecRole-ml-product-team/SageMaker is not authorized to perform: sagemaker:CreateTrainingJob on resource: arn:aws:sagemaker:eu-west-1:012348485732:training-job/sagemaker-tensorflow-2019-10-16-22-14-30-880 with an explicit deny
In this lab you modified the permissions granted to the instances of the data science team’s Jupyter notebooks. This altered their permissions so that they could only perform actions like creating a training job if that action met the security requirement of specifying a VPC configuration. Visit the defined products using the Service Catalog console to review the CloudFormation template and the changes it made to the permissions. Or use the IAM console to review the role you created and the policy attached to it. What conditions are on the IAM policy controlling access to the SageMaker API?