Skip to main content

notebook_instance_lifecycle_configs

Creates, updates, deletes, gets or lists a notebook_instance_lifecycle_configs resource.

Overview

Namenotebook_instance_lifecycle_configs
TypeResource
Idaws.sagemaker.notebook_instance_lifecycle_configs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
creation_timestring (date-time)A timestamp that tells when the lifecycle configuration was created.
last_modified_timestring (date-time)A timestamp that tells when the lifecycle configuration was last modified.
notebook_instance_lifecycle_config_arnstringThe Amazon Resource Name (ARN) of the lifecycle configuration.
notebook_instance_lifecycle_config_namestringThe name of the lifecycle configuration. (pattern: <code>[a-zA-Z0-9](-[a-zA-Z0-9])</code>)
on_createarrayThe shell script that runs only once, when you create a notebook instance.
on_startarrayThe shell script that runs every time you start a notebook instance, including when you create the notebook instance.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_notebook_instance_lifecycle_configselectregionReturns a description of a notebook instance lifecycle configuration. For information about notebook instance lifestyle configurations, see Step 2.1: (Optional) Customize a Notebook Instance.
list_notebook_instance_lifecycle_configsselectregionLists notebook instance lifestyle configurations created with the CreateNotebookInstanceLifecycleConfig API.
create_notebook_instance_lifecycle_configinsertregion, NotebookInstanceLifecycleConfigNameCreates a lifecycle configuration that you can associate with a notebook instance. A lifecycle configuration is a collection of shell scripts that run when you create or start a notebook instance. Each lifecycle configuration script has a limit of 16384 characters. The value of the $PATH environment variable that is available to both scripts is /sbin:bin:/usr/sbin:/usr/bin. View Amazon CloudWatch Logs for notebook instance lifecycle configurations in log group /aws/sagemaker/NotebookInstances in log stream [notebook-instance-name]/[LifecycleConfigHook]. Lifecycle configuration scripts cannot run for longer than 5 minutes. If a script runs for longer than 5 minutes, it fails and the notebook instance is not created or started. For information about notebook instance lifestyle configurations, see Step 2.1: (Optional) Customize a Notebook Instance. Lifecycle configuration scripts execute with root access and the notebook instance's IAM execution role privileges. Grant this permission only to trusted principals. See Customize a Notebook Instance Using a Lifecycle Configuration Script for security best practices.
update_notebook_instance_lifecycle_configupdateregion, NotebookInstanceLifecycleConfigNameUpdates a notebook instance lifecycle configuration created with the CreateNotebookInstanceLifecycleConfig API. Updates to lifecycle configurations affect all notebook instances using that configuration upon their next start. Lifecycle configuration scripts execute with root access and the notebook instance's IAM execution role privileges. Grant this permission only to trusted principals. See Customize a Notebook Instance Using a Lifecycle Configuration Script for security best practices.
delete_notebook_instance_lifecycle_configdeleteregionDeletes a notebook instance lifecycle configuration.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns a description of a notebook instance lifecycle configuration. For information about notebook instance lifestyle configurations, see Step 2.1: (Optional) Customize a Notebook Instance.

SELECT
creation_time,
last_modified_time,
notebook_instance_lifecycle_config_arn,
notebook_instance_lifecycle_config_name,
on_create,
on_start
FROM aws.sagemaker.notebook_instance_lifecycle_configs
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a lifecycle configuration that you can associate with a notebook instance. A lifecycle configuration is a collection of shell scripts that run when you create or start a notebook instance. Each lifecycle configuration script has a limit of 16384 characters. The value of the $PATH environment variable that is available to both scripts is /sbin:bin:/usr/sbin:/usr/bin. View Amazon CloudWatch Logs for notebook instance lifecycle configurations in log group /aws/sagemaker/NotebookInstances in log stream [notebook-instance-name]/[LifecycleConfigHook]. Lifecycle configuration scripts cannot run for longer than 5 minutes. If a script runs for longer than 5 minutes, it fails and the notebook instance is not created or started. For information about notebook instance lifestyle configurations, see Step 2.1: (Optional) Customize a Notebook Instance. Lifecycle configuration scripts execute with root access and the notebook instance's IAM execution role privileges. Grant this permission only to trusted principals. See Customize a Notebook Instance Using a Lifecycle Configuration Script for security best practices.

INSERT INTO aws.sagemaker.notebook_instance_lifecycle_configs (
NotebookInstanceLifecycleConfigName,
OnCreate,
OnStart,
Tags,
region
)
SELECT
'{{ NotebookInstanceLifecycleConfigName }}' /* required */,
'{{ OnCreate }}',
'{{ OnStart }}',
'{{ Tags }}',
'{{ region }}'
RETURNING
notebook_instance_lifecycle_config_arn
;

UPDATE examples

Updates a notebook instance lifecycle configuration created with the CreateNotebookInstanceLifecycleConfig API. Updates to lifecycle configurations affect all notebook instances using that configuration upon their next start. Lifecycle configuration scripts execute with root access and the notebook instance's IAM execution role privileges. Grant this permission only to trusted principals. See Customize a Notebook Instance Using a Lifecycle Configuration Script for security best practices.

UPDATE aws.sagemaker.notebook_instance_lifecycle_configs
SET
NotebookInstanceLifecycleConfigName = '{{ NotebookInstanceLifecycleConfigName }}',
OnCreate = '{{ OnCreate }}',
OnStart = '{{ OnStart }}'
WHERE
region = '{{ region }}' --required
AND NotebookInstanceLifecycleConfigName = '{{ NotebookInstanceLifecycleConfigName }}' --required;

DELETE examples

Deletes a notebook instance lifecycle configuration.

DELETE FROM aws.sagemaker.notebook_instance_lifecycle_configs
WHERE region = '{{ region }}' --required
;