create_notebook_instance
async
¶
create_notebook_instance(
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
notebook_instance_name: Optional[NotebookInstanceName] = None,
instance_type: Optional[InstanceType] = None,
subnet_id: Optional[SubnetId] = None,
security_group_ids: Optional[SecurityGroupIds] = None,
ip_address_type: Optional[IPAddressType] = None,
role_arn: Optional[RoleArn] = None,
kms_key_id: Optional[KmsKeyId] = None,
tags: Optional[TagList] = None,
lifecycle_config_name: Optional[NotebookInstanceLifecycleConfigName] = None,
direct_internet_access: Optional[DirectInternetAccess] = None,
volume_size_in_gb: Optional[NotebookInstanceVolumeSizeInGB] = None,
accelerator_types: Optional[NotebookInstanceAcceleratorTypes] = None,
default_code_repository: Optional[CodeRepositoryNameOrUrl] = None,
additional_code_repositories: Optional[AdditionalCodeRepositoryNamesOrUrls] = None,
root_access: Optional[RootAccess] = None,
platform_identifier: Optional[PlatformIdentifier] = None,
instance_metadata_service_configuration: Optional[
InstanceMetadataServiceConfiguration
] = None,
) -> CreateNotebookInstanceOutput
Creates an SageMaker AI notebook instance. A notebook instance is a machine learning (ML) compute instance running on a Jupyter notebook.
In a CreateNotebookInstance request, specify the type of ML compute instance that you want to run. SageMaker AI launches the instance, installs common libraries that you can use to explore datasets for model training, and attaches an ML storage volume to the notebook instance.
SageMaker AI also provides a set of example notebooks. Each notebook demonstrates how to use SageMaker AI with a specific algorithm or with a machine learning framework.
After receiving the request, SageMaker AI does the following:
-
Creates a network interface in the SageMaker AI VPC.
-
(Option) If you specified
SubnetId, SageMaker AI creates a network interface in your own VPC, which is inferred from the subnet ID that you provide in the input. When creating this network interface, SageMaker AI attaches the security group that you specified in the request to the network interface that it creates in your VPC. -
Launches an EC2 instance of the type specified in the request in the SageMaker AI VPC. If you specified
SubnetIdof your VPC, SageMaker AI specifies both network interfaces when launching this instance. This enables inbound traffic from your own VPC to the notebook instance, assuming that the security groups allow it.
After creating the notebook instance, SageMaker AI returns its Amazon Resource Name (ARN). You can't change the name of a notebook instance after you create it.
After SageMaker AI creates the notebook instance, you can connect to the Jupyter server and work in Jupyter notebooks. For example, you can write code to explore a dataset that you can use for model training, train a model, host models by creating SageMaker AI endpoints, and validate hosted models.
For more information, see How It Works.
Parameters:
-
notebook_instance_name(Optional[NotebookInstanceName], default:None) –The name of the new notebook instance.
-
instance_type(Optional[InstanceType], default:None) –The type of ML compute instance to launch for the notebook instance.
-
subnet_id(Optional[SubnetId], default:None) –The ID of the subnet in a VPC to which you would like to have a connectivity from your ML compute instance.
-
security_group_ids(Optional[SecurityGroupIds], default:None) –The VPC security group IDs, in the form sg-xxxxxxxx. The security groups must be for the same VPC as specified in the subnet.
-
ip_address_type(Optional[IPAddressType], default:None) –The IP address type for the notebook instance. Specify
ipv4for IPv4-only connectivity ordualstackfor both IPv4 and IPv6 connectivity. When you specifydualstack, the subnet must support IPv6 CIDR blocks. If not specified, defaults toipv4. -
role_arn(Optional[RoleArn], default:None) –When you send any requests to Amazon Web Services resources from the notebook instance, SageMaker AI assumes this role to perform tasks on your behalf. You must grant this role necessary permissions so SageMaker AI can perform these tasks. The policy must allow the SageMaker AI service principal (sagemaker.amazonaws.com) permissions to assume this role. For more information, see SageMaker AI Roles.
To be able to pass this role to SageMaker AI, the caller of this API must have the
iam:PassRolepermission. -
kms_key_id(Optional[KmsKeyId], default:None) –The Amazon Resource Name (ARN) of a Amazon Web Services Key Management Service key that SageMaker AI uses to encrypt data on the storage volume attached to your notebook instance. The KMS key you provide must be enabled. For information, see Enabling and Disabling Keys in the Amazon Web Services Key Management Service Developer Guide.
-
tags(Optional[TagList], default:None) –An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see Tagging Amazon Web Services Resources.
-
lifecycle_config_name(Optional[NotebookInstanceLifecycleConfigName], default:None) –The name of a lifecycle configuration to associate with the notebook instance. For information about lifestyle configurations, see Step 2.1: (Optional) Customize a Notebook Instance.
-
direct_internet_access(Optional[DirectInternetAccess], default:None) –Sets whether SageMaker AI provides internet access to the notebook instance. If you set this to
Disabledthis notebook instance is able to access resources only in your VPC, and is not be able to connect to SageMaker AI training and endpoint services unless you configure a NAT Gateway in your VPC.For more information, see Notebook Instances Are Internet-Enabled by Default. You can set the value of this parameter to
Disabledonly if you set a value for theSubnetIdparameter. -
volume_size_in_gb(Optional[NotebookInstanceVolumeSizeInGB], default:None) –The size, in GB, of the ML storage volume to attach to the notebook instance. The default value is 5 GB.
-
accelerator_types(Optional[NotebookInstanceAcceleratorTypes], default:None) –This parameter is no longer supported. Elastic Inference (EI) is no longer available.
This parameter was used to specify a list of EI instance types to associate with this notebook instance.
-
default_code_repository(Optional[CodeRepositoryNameOrUrl], default:None) –A Git repository to associate 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 Amazon Web Services CodeCommit or in any other Git repository. When you open a notebook instance, it opens in the directory that contains this repository. For more information, see Associating Git Repositories with SageMaker AI Notebook Instances.
-
additional_code_repositories(Optional[AdditionalCodeRepositoryNamesOrUrls], default:None) –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 Amazon Web Services CodeCommit or in any other Git repository. These repositories are cloned at the same level as the default repository of your notebook instance. For more information, see Associating Git Repositories with SageMaker AI Notebook Instances.
-
root_access(Optional[RootAccess], default:None) –Whether root access is enabled or disabled for users of the notebook instance. The default value is
Enabled.Lifecycle configurations need root access to be able to set up a notebook instance. Because of this, lifecycle configurations associated with a notebook instance always run with root access even if you disable root access for users.
-
platform_identifier(Optional[PlatformIdentifier], default:None) –The platform identifier of the notebook instance runtime environment. The default value is
notebook-al2023-v1. -
instance_metadata_service_configuration(Optional[InstanceMetadataServiceConfiguration], default:None) –Information on the IMDS configuration of the notebook instance
Raises:
-
ResourceLimitExceeded–You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 | |