aws-samples / sagemaker-studio-lifecycle-config-examples

MIT No Attribution
78 stars 51 forks source link

SageMaker Studio Classic Lifecycle Configuration Samples

Overview

A collection of sample scripts customizing SageMaker Studio Classic Applications using Lifecycle Configurations. To customize the new Studio experience that runs on JupyterLab applications (including an LCC script to automatically shut down idle JupyterLab apps), refer to the repository here - https://github.com/aws-samples/sagemaker-studio-apps-lifecycle-config-examples/tree/main.

Lifecycle Configurations for Studio Classic provide a mechanism to customize the Jupyter Server and Kernel Application instances via shell scripts that are executed during the lifecycle of the application. For information on customizing Studio Classic using Lifecycle configurations, refer to the documentation. In addition to the directions to set LCC script using the AWS CLI as showcased in this repository, you can also create and assign the LCCs to domains or users through the AWS Console. For console instructions, see here.

⚠️ Warning: If you're using a Windows computer, be aware LCC scripts must use Unix-style LF line endings rather than Windows-style CRLF. You might find issues if uploading scripts through the AWS Console today, so we'd suggest using the CLI/APIs instead

Sample Scripts

Troubleshooting

When a Studio app is started with a LCC enabled, an Amazon CloudWatch Log stream is created within the /aws/sagemaker/studio log group (you must be signed in to your AWS account for this link to work), with a name like $DOMAIN_ID/$USER_PROFILE_NAME/$APP_TYPE/$APP_NAME/LifecycleConfigOnStart (where e.g. $APP_TYPE could be JupyterServer or KernelGateway for Studio Classic apps). You can use these log streams to debug any problems while customizing your LCCs.

Developing LCC Scripts for SageMaker Studio

For best practicies, please check the DEVELOPMENT.md.