How to include lifecycle configuration in Sagemaker studio's user notebook
Original source
You can follow this tutorial:
https://modelpredict.com/sagemaker-stop-your-instances-when-idle/
Summary
Basically, you have to go to the notebook instance where you want to apply the Lifecycle Configuration, stop it, and go to: Additional configuration &gt; Lifecycle Configuration &gt; [Select your script].
After this, you have to configure the proper permissions for the Lifecycle Configuration script to stop your notebook instance. To do so, create a new policy, and paste the following code:
{
  &quot;Version&quot;: &quot;2012-10-17&quot;,
  &quot;Statement&quot;: [
      {
          &quot;Sid&quot;: &quot;VisualEditor0&quot;,
          &quot;Effect&quot;: &quot;Allow&quot;,
          &quot;Action&quot;: [
              &quot;sagemaker:StopNotebookInstance&quot;,
              &quot;sagemaker:DescribeNotebookInstance&quot;
          ],
          &quot;Resource&quot;: &quot;*&quot;
      }
  ]
}

After this, attach it to your Notebook instance and it's done!