Skip to content

Resource: awsSagemakerNotebookInstance

Provides a SageMaker Notebook Instance resource.

Example Usage

Basic usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.sagemakerNotebookInstance.SagemakerNotebookInstance(this, "ni", {
  instanceType: "ml.t2.medium",
  name: "my-notebook-instance",
  roleArn: "${aws_iam_role.role.arn}",
  tags: {
    Name: "foo",
  },
});

Code repository usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsSagemakerCodeRepositoryExample =
  new aws.sagemakerCodeRepository.SagemakerCodeRepository(this, "example", {
    codeRepositoryName: "my-notebook-instance-code-repo",
    gitConfig: {
      repositoryUrl: "https://github.com/hashicorp/terraform-provider-aws.git",
    },
  });
new aws.sagemakerNotebookInstance.SagemakerNotebookInstance(this, "ni", {
  defaultCodeRepository: awsSagemakerCodeRepositoryExample.codeRepositoryName,
  instanceType: "ml.t2.medium",
  name: "my-notebook-instance",
  roleArn: "${aws_iam_role.role.arn}",
  tags: {
    Name: "foo",
  },
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the notebook instance (must be unique).
  • roleArn - (Required) The ARN of the IAM role to be used by the notebook instance which allows SageMaker to call other services on your behalf.
  • instanceType - (Required) The name of ML compute instance type.
  • platformIdentifier - (Optional) The platform identifier of the notebook instance runtime environment. This value can be either notebookAl1V1, notebookAl2V1, or notebookAl2V2, depending on which version of Amazon Linux you require.
  • volumeSize - (Optional) The size, in GB, of the ML storage volume to attach to the notebook instance. The default value is 5 GB.
  • subnetId - (Optional) The VPC subnet ID.
  • securityGroups - (Optional) The associated security groups.
  • acceleratorTypes - (Optional) A list of Elastic Inference (EI) instance types to associate with this notebook instance. See Elastic Inference Accelerator for more details. Valid values: mlEia1Medium, mlEia1Large, mlEia1Xlarge, mlEia2Medium, mlEia2Large, mlEia2Xlarge.
  • additionalCodeRepositories - (Optional) An array of up to three Git repositories to associate with the notebook instance. These can be either the names of Git repositories stored as resources in your account, or the URL of Git repositories in AWS CodeCommit or in any other Git repository. These repositories are cloned at the same level as the default repository of your notebook instance.
  • defaultCodeRepository - (Optional) The Git repository associated with the notebook instance as its default code repository. This can be either the name of a Git repository stored as a resource in your account, or the URL of a Git repository in AWS CodeCommit or in any other Git repository.
  • directInternetAccess - (Optional) Set to disabled to disable internet access to notebook. Requires securityGroups and subnetId to be set. Supported values: enabled (Default) or disabled. If set to disabled, the notebook instance will be able to access resources only in your VPC, and will not be able to connect to Amazon SageMaker training and endpoint services unless your configure a NAT Gateway in your VPC.
  • instanceMetadataServiceConfiguration - (Optional) Information on the IMDS configuration of the notebook instance. Conflicts with instanceMetadataServiceConfiguration. see details below.
  • kmsKeyId - (Optional) The AWS Key Management Service (AWS KMS) key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption.
  • lifecycleConfigName - (Optional) The name of a lifecycle configuration to associate with the notebook instance.
  • rootAccess - (Optional) Whether root access is enabled or disabled for users of the notebook instance. The default value is enabled.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

instanceMetadataServiceConfiguration

  • minimumInstanceMetadataServiceVersion - (Optional) Indicates the minimum IMDS version that the notebook instance supports. When passed "1" is passed. This means that both IMDSv1 and IMDSv2 are supported. Valid values are 1 and 2.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The name of the notebook instance.
  • arn - The Amazon Resource Name (ARN) assigned by AWS to this notebook instance.
  • url - The URL that you use to connect to the Jupyter notebook that is running in your notebook instance.
  • networkInterfaceId - The network interface ID that Amazon SageMaker created at the time of creating the instance. Only available when setting subnetId.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

SageMaker Notebook Instances can be imported using the name, e.g.,

$ terraform import aws_sagemaker_notebook_instance.test_notebook_instance my-notebook-instance