AWS Amazon SageMaker Notebook Instance Lifecycle Configuration

This page shows how to write Terraform and CloudFormation for Amazon SageMaker Notebook Instance Lifecycle Configuration and write them securely.

aws_sagemaker_notebook_instance_lifecycle_configuration (Terraform)

The Notebook Instance Lifecycle Configuration in Amazon SageMaker can be configured in Terraform with the resource name aws_sagemaker_notebook_instance_lifecycle_configuration. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

lifecycle_configuration.tf#L9
resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "basic_lifecycle" {
  name      = "dev-platform-al-sm-frauddetection-lifecycle-config"
  on_create = base64encode(data.template_file.on_create.rendered)
  on_start  = base64encode(data.template_file.on_start.rendered)

  depends_on = [aws_s3_bucket.s3_bucket_model_training_data]
main.tf#L2
resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "main" {
  name      = var.name
  on_create = var.on_create
  on_start  = var.on_start
}

lifecycle_configuration.tf#L2
resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "notebook_config" {
  name = "dev-platform-al-sm-lifecycle-config"
  on_create = filebase64("../scripts/on-create.sh")
  on_start = filebase64("../scripts/on-start.sh")

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a lifecycle configuration for SageMaker Notebook Instances.

AWS::SageMaker::NotebookInstanceLifecycleConfig (CloudFormation)

The NotebookInstanceLifecycleConfig in SageMaker can be configured in CloudFormation with the resource name AWS::SageMaker::NotebookInstanceLifecycleConfig. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

The AWS::SageMaker::NotebookInstanceLifecycleConfig resource creates shell scripts that run when you create and/or start a notebook instance. For information about notebook instance lifecycle configurations, see Customize a Notebook Instance in the Amazon SageMaker Developer Guide.

Frequently asked questions

What is AWS Amazon SageMaker Notebook Instance Lifecycle Configuration?

AWS Amazon SageMaker Notebook Instance Lifecycle Configuration is a resource for Amazon SageMaker of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon SageMaker Notebook Instance Lifecycle Configuration?

For Terraform, the AndreasLuckert/fraud-detection-using-terraform-and-sagemaker, boldlink/terraform and AndreasLuckert/aws-sm-notebook-instance source code examples are useful. See the Terraform Example section for further details.