NotebookInstance class

Provides a SageMaker AI Notebook Instance resource.

Example Usage

Basic usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ni = new aws.sagemaker.NotebookInstance("ni", {
    name: "my-notebook-instance",
    roleArn: role.arn,
    instanceType: "ml.t2.medium",
    tags: {
        Name: "foo",
    },
});
import pulumi
import pulumi_aws as aws

ni = aws.sagemaker.NotebookInstance("ni",
    name="my-notebook-instance",
    role_arn=role["arn"],
    instance_type="ml.t2.medium",
    tags={
        "Name": "foo",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var ni = new Aws.Sagemaker.NotebookInstance("ni", new()
    {
        Name = "my-notebook-instance",
        RoleArn = role.Arn,
        InstanceType = "ml.t2.medium",
        Tags =
        {
            { "Name", "foo" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sagemaker"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sagemaker.NewNotebookInstance(ctx, "ni", &sagemaker.NotebookInstanceArgs{
			Name:         pulumi.String("my-notebook-instance"),
			RoleArn:      pulumi.Any(role.Arn),
			InstanceType: pulumi.String("ml.t2.medium"),
			Tags: pulumi.StringMap{
				"Name": pulumi.String("foo"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_sagemaker_notebookinstance" "ni" {
  name          = "my-notebook-instance"
  role_arn      = role.arn
  instance_type = "ml.t2.medium"
  tags = {
    "Name" = "foo"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sagemaker.NotebookInstance;
import com.pulumi.aws.sagemaker.NotebookInstanceArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var ni = new NotebookInstance("ni", NotebookInstanceArgs.builder()
            .name("my-notebook-instance")
            .roleArn(role.arn())
            .instanceType("ml.t2.medium")
            .tags(Map.of("Name", "foo"))
            .build());

    }
}
resources:
  ni:
    type: aws:sagemaker:NotebookInstance
    properties:
      name: my-notebook-instance
      roleArn: ${role.arn}
      instanceType: ml.t2.medium
      tags:
        Name: foo

Code repository usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.sagemaker.CodeRepository("example", {
    gitConfig: {
        repositoryUrl: "https://github.com/github/docs.git",
    },
    codeRepositoryName: "my-notebook-instance-code-repo",
});
const ni = new aws.sagemaker.NotebookInstance("ni", {
    name: "my-notebook-instance",
    roleArn: role.arn,
    instanceType: "ml.t2.medium",
    defaultCodeRepository: example.codeRepositoryName,
    tags: {
        Name: "foo",
    },
});
import pulumi
import pulumi_aws as aws

example = aws.sagemaker.CodeRepository("example",
    git_config={
        "repository_url": "https://github.com/github/docs.git",
    },
    code_repository_name="my-notebook-instance-code-repo")
ni = aws.sagemaker.NotebookInstance("ni",
    name="my-notebook-instance",
    role_arn=role["arn"],
    instance_type="ml.t2.medium",
    default_code_repository=example.code_repository_name,
    tags={
        "Name": "foo",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Sagemaker.CodeRepository("example", new()
    {
        GitConfig = new Aws.Sagemaker.Inputs.CodeRepositoryGitConfigArgs
        {
            RepositoryUrl = "https://github.com/github/docs.git",
        },
        CodeRepositoryName = "my-notebook-instance-code-repo",
    });

    var ni = new Aws.Sagemaker.NotebookInstance("ni", new()
    {
        Name = "my-notebook-instance",
        RoleArn = role.Arn,
        InstanceType = "ml.t2.medium",
        DefaultCodeRepository = example.CodeRepositoryName,
        Tags =
        {
            { "Name", "foo" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sagemaker"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := sagemaker.NewCodeRepository(ctx, "example", &sagemaker.CodeRepositoryArgs{
			GitConfig: &sagemaker.CodeRepositoryGitConfigArgs{
				RepositoryUrl: pulumi.String("https://github.com/github/docs.git"),
			},
			CodeRepositoryName: pulumi.String("my-notebook-instance-code-repo"),
		})
		if err != nil {
			return err
		}
		_, err = sagemaker.NewNotebookInstance(ctx, "ni", &sagemaker.NotebookInstanceArgs{
			Name:                  pulumi.String("my-notebook-instance"),
			RoleArn:               pulumi.Any(role.Arn),
			InstanceType:          pulumi.String("ml.t2.medium"),
			DefaultCodeRepository: example.CodeRepositoryName,
			Tags: pulumi.StringMap{
				"Name": pulumi.String("foo"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_sagemaker_coderepository" "example" {
  git_config = {
    repository_url = "https://github.com/github/docs.git"
  }
  code_repository_name = "my-notebook-instance-code-repo"
}
resource "aws_sagemaker_notebookinstance" "ni" {
  name                    = "my-notebook-instance"
  role_arn                = role.arn
  instance_type           = "ml.t2.medium"
  default_code_repository = aws_sagemaker_coderepository.example.code_repository_name
  tags = {
    "Name" = "foo"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sagemaker.CodeRepository;
import com.pulumi.aws.sagemaker.CodeRepositoryArgs;
import com.pulumi.aws.sagemaker.inputs.CodeRepositoryGitConfigArgs;
import com.pulumi.aws.sagemaker.NotebookInstance;
import com.pulumi.aws.sagemaker.NotebookInstanceArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new CodeRepository("example", CodeRepositoryArgs.builder()
            .gitConfig(CodeRepositoryGitConfigArgs.builder()
                .repositoryUrl("https://github.com/github/docs.git")
                .build())
            .codeRepositoryName("my-notebook-instance-code-repo")
            .build());

        var ni = new NotebookInstance("ni", NotebookInstanceArgs.builder()
            .name("my-notebook-instance")
            .roleArn(role.arn())
            .instanceType("ml.t2.medium")
            .defaultCodeRepository(example.codeRepositoryName())
            .tags(Map.of("Name", "foo"))
            .build());

    }
}
resources:
  example:
    type: aws:sagemaker:CodeRepository
    properties:
      gitConfig:
        repositoryUrl: https://github.com/github/docs.git
      codeRepositoryName: my-notebook-instance-code-repo
  ni:
    type: aws:sagemaker:NotebookInstance
    properties:
      name: my-notebook-instance
      roleArn: ${role.arn}
      instanceType: ml.t2.medium
      defaultCodeRepository: ${example.codeRepositoryName}
      tags:
        Name: foo

Import

Using pulumi import, import SageMaker AI Notebook Instances using the name. For example:

$ pulumi import aws:sagemaker/notebookInstance:NotebookInstance test_notebook_instance my-notebook-instance

Constructors

NotebookInstance(String name, {NotebookInstanceArgs? args, CustomResourceOptions? options})
Creates a new NotebookInstance. name The Pulumi resource name. args Arguments used to configure this NotebookInstance. The set of arguments for NotebookInstance. options Resource options controlling this resource's behavior.
NotebookInstance.reference(String urn)
Creates a typed reference to an existing NotebookInstance resource.

Properties

additionalCodeRepositories ↔ Output<List<String>?>
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.
latefinal
arn ↔ Output<String>
ARN assigned by AWS to this notebook instance.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
defaultCodeRepository ↔ Output<String?>
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.
latefinal
directInternetAccess ↔ Output<String?>
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 AI training and endpoint services unless your configure a NAT Gateway in your VPC.
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
instanceMetadataServiceConfiguration ↔ Output<NotebookInstanceInstanceMetadataServiceConfiguration?>
Information on the IMDS configuration of the notebook instance. Conflicts with instanceMetadataServiceConfiguration. see details below.
latefinal
instanceType ↔ Output<String>
The name of ML compute instance type.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
kmsKeyId ↔ Output<String?>
KMS key that Amazon SageMaker AI uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption.
latefinal
lifecycleConfigName ↔ Output<String?>
The name of a lifecycle configuration to associate with the notebook instance.
latefinal
name ↔ Output<String>
The name of the notebook instance (must be unique).
latefinal
networkInterfaceId ↔ Output<String>
The network interface ID that Amazon SageMaker AI created at the time of creating the instance. Only available when setting subnetId.
latefinal
platformIdentifier ↔ Output<String>
The platform identifier of the notebook instance runtime environment. This value can be either notebook-al1-v1(deprecated), notebook-al2-v1(deprecated), notebook-al2-v2(deprecated), notebook-al2-v3, or notebook-al2023-v1, depending on which version of Amazon Linux you require. Defaults to notebook-al2-v3.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
roleArn ↔ Output<String>
The ARN of the IAM role to be used by the notebook instance which allows SageMaker AI to call other services on your behalf.
latefinal
rootAccess ↔ Output<String?>
Whether root access is Enabled or Disabled for users of the notebook instance. The default value is Enabled.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
securityGroups ↔ Output<List<String>>
The associated security groups.
latefinal
subnetId ↔ Output<String?>
The VPC subnet ID.
latefinal
tags ↔ Output<Map<String, String>?>
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.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
url ↔ Output<String>
The URL that you use to connect to the Jupyter notebook that is running in your notebook instance.
latefinal
urn ↔ Output<String>
latefinalinherited
volumeSize ↔ Output<int?>
The size, in GB, of the ML storage volume to attach to the notebook instance. The default value is 5 GB.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {NotebookInstanceState? state, CustomResourceOptions? options}) NotebookInstance
Gets an existing NotebookInstance resource's state with the given name and id.