Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::SageMaker::NotebookInstance

The AWS::SageMaker::NotebookInstance resource Creates an Amazon SageMaker notebook instance. A notebook instance is a machine learning (ML) compute instance running on a Jupyter notebook. For more information, see Using Notebook Instances in the Amazon SageMaker Developer Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::SageMaker::NotebookInstance", "Properties" : { "KmsKeyId" : String, "DirectInternetAccess" : String, "SubnetId" : String, "NotebookInstanceName" : String, "InstanceType" : String, "LifecycleConfigName" : String, "SecurityGroupIds" : [ String, ... ], "RoleArn" : String, "Tags" : [ Tag, ... ] } }

YAML

Type: "AWS::SageMaker::NotebookInstance" Properties: KmsKeyId: String DirectInternetAccess: String SubnetId: String NotebookInstanceName: String InstanceType: String LifecycleConfigName: String SecurityGroupIds: - String RoleArn: String Tags: - Tag

Properties

KmsKeyId

If you provide a AWS KMS key ID, Amazon SageMaker uses it to encrypt data at rest on the ML storage volume that is attached to your notebook instance.

Required: No

Type: String

Update requires: Replacement

DirectInternetAccess

Sets whether Amazon SageMaker provides internet access to the notebook instance. If you set this to Disabled this 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. For more information, see Notebook Instances Are Enabled with Internet Access by Default. You can set the value of this parameter to Disabled only if you set a value for the SubnetId parameter.

Required: No

Type: String

Update requires: Replacement

SubnetId

The ID of the subnet in a VPC to which you would like to have a connectivity from your ML compute instance.

Required: No

Type: String

Update requires: Replacement

NotebookInstanceName

The name of the notebook instance.

Required: No

Type: String

Update requires: Replacement

InstanceType

The type of ML compute instance to launch for the notebook instance.

Required: Yes

Type: String

Update requires: No interruption

LifecycleConfigName

The name of a lifecycle configuration to associate with the notebook instance. For information about lifestyle configurations, see Customize a Notebook Instance in the Amazon SageMaker Developer Guide.

Required: No

Type: String

Update requires: Replacement

SecurityGroupIds

The VPC security group IDs, in the form sg-xxxxxxxx. The security groups must be for the same VPC as specified in the subnet.

Required: No

Type: List of Strings

Update requires: Replacement

RoleArn

When you send any requests to AWS resources from the notebook instance, Amazon SageMaker assumes this role to perform tasks on your behalf. You must grant this role necessary permissions so Amazon SageMaker can perform these tasks. The policy must allow the Amazon SageMaker service principal (sagemaker.amazonaws.com) permissions to assume this role. For more information, see Amazon SageMaker Roles.

Required: Yes

Type:

Update requires: No interruption

Tags

A list of tags to associate with the notebook instance.

Required: No

Type: List of Amazon SageMaker NotebookInstance Tag

Update requires: No interruption

Return Values

Ref

When you pass the logical ID of an AWS::SageMaker::NotebookInstance resource to the intrinsic Ref function, the function returns the Amazon Resource Name (ARN) of the notebook instance, such as arn:aws:sagemaker:us-west-2:012345678901:notebook-instance/mynotebookinstance.

For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

NotebookInstanceName

The name of the notebook instance, such as MyNotebookInstance.

For more information about using Fn::GetAtt, see Fn::GetAtt.

Examples

SageMaker Notebook Instance Example

The following example creates a notebook instance.

JSON

{ "Description": "Basic NotebookInstance test update to a different instance type", "Resources": { "BasicNotebookInstance": { "Type": "AWS::SageMaker::NotebookInstance", "Properties": { "InstanceType": "ml.t2.large", "RoleArn": { "Fn::GetAtt" : [ "ExecutionRole", "Arn" ] } } }, "ExecutionRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "sagemaker.amazonaws.com" ] }, "Action": [ "sts:AssumeRole" ] } ] }, "Path": "/", "Policies": [ { "PolicyName": "root", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "*", "Resource": "*" } ] } } ] } } }, "Outputs": { "BasicNotebookInstanceId": { "Value": { "Ref" : "BasicNotebookInstance" } } }, }

YAML

Description: "Basic NotebookInstance test update to a different instance type" Resources: BasicNotebookInstance: Type: "AWS::SageMaker::NotebookInstance" Properties: InstanceType: "ml.t2.large" RoleArn: !GetAtt ExecutionRole.Arn ExecutionRole: Type: "AWS::IAM::Role" Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Principal: Service: - "sagemaker.amazonaws.com" Action: - "sts:AssumeRole" Path: "/" Policies: - PolicyName: "root" PolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Action: "*" Resource: "*" Outputs: BasicNotebookInstanceId: Value: !Ref BasicNotebookInstance