SageMaker notebook instances with no lifecycle configuration to stop them when idle
What does ZopNight detect here?
ZopNight looks for SageMaker notebook instances that ZopNight confirmed have no attached `NotebookInstanceLifecycleConfigName`, so nothing stops them when they go idle. A priced finding needs a measured idle pattern for the notebook, and notebook instances do not give ZopNight an activity signal yet, so the rule currently stays silent; the manual check below still applies.
Signal and threshold
| Field | Value |
|---|---|
| Rule IDs | RC-1502 |
| Category | schedule |
| Severity | medium |
| Metric | none — pure configuration read |
| Threshold | no lifecycle configuration attached |
| Source | ZopNight |
| Permissions used | sagemaker:ListNotebookInstances · sagemaker:DescribeNotebookInstance |
Where it applies
Notebook instances bill until someone stops them
SageMaker notebook instances are charged for the instance type you choose, based on the duration of use, per SageMaker AI pricing. Closing the browser tab does not stop them. A data scientist who opens a GPU notebook on Monday and forgets it keeps paying until the instance is stopped by hand.
AWS’s answer is a lifecycle configuration. The
lifecycle configuration docs
describe shell scripts that run when a notebook instance is created or started, and AWS publishes a
sample repository whose auto-stop-idle script stops a notebook after an idle period, one hour by
default.
Listing notebooks with no lifecycle configuration
aws sagemaker list-notebook-instances --status-equals InService \ --query 'NotebookInstances[?NotebookInstanceLifecycleConfigName==null].[NotebookInstanceName,InstanceType]' \ --output tableConditions for a finding
- ZopNight checked the notebook and found no lifecycle configuration attached. If the check did not run or failed, ZopNight assumes nothing.
- The notebook has a known monthly cost.
- ZopNight has a measured usage pattern for the notebook with an idle share above zero.
Why these notebooks show nothing yet
The third condition is the one that is missing. ZopNight does not receive a usage signal for notebook instances today, so it cannot measure when a notebook is idle and it will not price one from a guess. The rule therefore raises no finding for now. It becomes active once a notebook activity signal, such as instance metrics published by an agent, is available. The configuration gap on its own is reported as a compliance finding by SageMaker Notebook Has No Lifecycle Configuration.
What an idle schedule would save
saving = monthly notebook cost x measured idle shareFor a notebook used during office hours only, the idle share is most of the week.
Adding an idle auto-stop
- Take
on-start.shfrom the auto-stop-idle sample and setIDLE_TIMEto suit the team, for example 3600 seconds. - Create the configuration, passing the script base64-encoded:
aws sagemaker create-notebook-instance-lifecycle-config --notebook-instance-lifecycle-config-name auto-stop --on-start Content=$(base64 < on-start.sh | tr -d '\n') - Stop the notebook, attach the configuration and start it again:
aws sagemaker stop-notebook-instance --notebook-instance-name ds-notebook, thenaws sagemaker update-notebook-instance --notebook-instance-name ds-notebook --lifecycle-config-name auto-stop.