Amazon SageMaker Service

2018/03/15 - Amazon SageMaker Service - 5 new 4 updated api methods

Changes  This release provides support for ml.p3.xlarge instance types for notebook instances. Lifecycle configuration is now available to customize your notebook instances on start; the configuration can be reused between multiple notebooks. If a notebook instance is attached to a VPC you can now opt out of internet access that by default is provided by SageMaker.

DeleteNotebookInstanceLifecycleConfig (new) Link ¶

Deletes a notebook instance lifecycle configuration.

See also: AWS API Documentation

Request Syntax

client.delete_notebook_instance_lifecycle_config(
    NotebookInstanceLifecycleConfigName='string'
)
type NotebookInstanceLifecycleConfigName

string

param NotebookInstanceLifecycleConfigName

[REQUIRED]

The name of the lifecycle configuration to delete.

returns

None

UpdateNotebookInstanceLifecycleConfig (new) Link ¶

Updates a notebook instance lifecycle configuration created with the API.

See also: AWS API Documentation

Request Syntax

client.update_notebook_instance_lifecycle_config(
    NotebookInstanceLifecycleConfigName='string',
    OnCreate=[
        {
            'Content': 'string'
        },
    ],
    OnStart=[
        {
            'Content': 'string'
        },
    ]
)
type NotebookInstanceLifecycleConfigName

string

param NotebookInstanceLifecycleConfigName

[REQUIRED]

The name of the lifecycle configuration.

type OnCreate

list

param OnCreate

The shell script that runs only once, when you create a notebook instance

  • (dict) --

    Contains the notebook instance lifecycle configuration script.

    This script runs in the path /sbin:bin:/usr/sbin:/usr/bin .

    For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

    • Content (string) --

      A base64-encoded string that contains a shell script for a notebook instance lifecycle configuration.

type OnStart

list

param OnStart

The shell script that runs every time you start a notebook instance, including when you create the notebook instance.

  • (dict) --

    Contains the notebook instance lifecycle configuration script.

    This script runs in the path /sbin:bin:/usr/sbin:/usr/bin .

    For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

    • Content (string) --

      A base64-encoded string that contains a shell script for a notebook instance lifecycle configuration.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateNotebookInstanceLifecycleConfig (new) Link ¶

Creates a lifecycle configuration that you can associate with a notebook instance. A lifecycle configuration is a collection of shell scripts that run when you create or start a notebook instance.

For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

See also: AWS API Documentation

Request Syntax

client.create_notebook_instance_lifecycle_config(
    NotebookInstanceLifecycleConfigName='string',
    OnCreate=[
        {
            'Content': 'string'
        },
    ],
    OnStart=[
        {
            'Content': 'string'
        },
    ]
)
type NotebookInstanceLifecycleConfigName

string

param NotebookInstanceLifecycleConfigName

[REQUIRED]

The name of the lifecycle configuration.

type OnCreate

list

param OnCreate

A shell script that runs only once, when you create a notebook instance.

  • (dict) --

    Contains the notebook instance lifecycle configuration script.

    This script runs in the path /sbin:bin:/usr/sbin:/usr/bin .

    For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

    • Content (string) --

      A base64-encoded string that contains a shell script for a notebook instance lifecycle configuration.

type OnStart

list

param OnStart

A shell script that runs every time you start a notebook instance, including when you create the notebook instance.

  • (dict) --

    Contains the notebook instance lifecycle configuration script.

    This script runs in the path /sbin:bin:/usr/sbin:/usr/bin .

    For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

    • Content (string) --

      A base64-encoded string that contains a shell script for a notebook instance lifecycle configuration.

rtype

dict

returns

Response Syntax

{
    'NotebookInstanceLifecycleConfigArn': 'string'
}

Response Structure

  • (dict) --

    • NotebookInstanceLifecycleConfigArn (string) --

      The Amazon Resource Name (ARN) of the lifecycle configuration.

ListNotebookInstanceLifecycleConfigs (new) Link ¶

Lists notebook instance lifestyle configurations created with the API.

See also: AWS API Documentation

Request Syntax

client.list_notebook_instance_lifecycle_configs(
    NextToken='string',
    MaxResults=123,
    SortBy='Name'|'CreationTime'|'LastModifiedTime',
    SortOrder='Ascending'|'Descending',
    NameContains='string',
    CreationTimeBefore=datetime(2015, 1, 1),
    CreationTimeAfter=datetime(2015, 1, 1),
    LastModifiedTimeBefore=datetime(2015, 1, 1),
    LastModifiedTimeAfter=datetime(2015, 1, 1)
)
type NextToken

string

param NextToken

If the result of a ListNotebookInstanceLifecycleConfigs request was truncated, the response includes a NextToken . To get the next set of lifecycle configurations, use the token in the next request.

type MaxResults

integer

param MaxResults

The maximum number of lifecycle configurations to return in the response.

type SortBy

string

param SortBy

Sorts the list of results. The default is CreationTime .

type SortOrder

string

param SortOrder

The sort order for results.

type NameContains

string

param NameContains

A string in the lifecycle configuration name. This filter returns only lifecycle configurations whose name contains the specified string.

type CreationTimeBefore

datetime

param CreationTimeBefore

A filter that returns only lifecycle configurations that were created before the specified time (timestamp).

type CreationTimeAfter

datetime

param CreationTimeAfter

A filter that returns only lifecycle configurations that were created after the specified time (timestamp).

type LastModifiedTimeBefore

datetime

param LastModifiedTimeBefore

A filter that returns only lifecycle configurations that were modified before the specified time (timestamp).

type LastModifiedTimeAfter

datetime

param LastModifiedTimeAfter

A filter that returns only lifecycle configurations that were modified after the specified time (timestamp).

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'NotebookInstanceLifecycleConfigs': [
        {
            'NotebookInstanceLifecycleConfigName': 'string',
            'NotebookInstanceLifecycleConfigArn': 'string',
            'CreationTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      If the response is truncated, Amazon SageMaker returns this token. To get the next set of lifecycle configurations, use it in the next request.

    • NotebookInstanceLifecycleConfigs (list) --

      An array of NotebookInstanceLifecycleConfiguration objects, each listing a lifecycle configuration.

      • (dict) --

        Provides a summary of a notebook instance lifecycle configuration.

        • NotebookInstanceLifecycleConfigName (string) --

          The name of the lifecycle configuration.

        • NotebookInstanceLifecycleConfigArn (string) --

          The Amazon Resource Name (ARN) of the lifecycle configuration.

        • CreationTime (datetime) --

          A timestamp that tells when the lifecycle configuration was created.

        • LastModifiedTime (datetime) --

          A timestamp that tells when the lifecycle configuration was last modified.

DescribeNotebookInstanceLifecycleConfig (new) Link ¶

Returns a description of a notebook instance lifecycle configuration.

For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

See also: AWS API Documentation

Request Syntax

client.describe_notebook_instance_lifecycle_config(
    NotebookInstanceLifecycleConfigName='string'
)
type NotebookInstanceLifecycleConfigName

string

param NotebookInstanceLifecycleConfigName

[REQUIRED]

The name of the lifecycle configuration to describe.

rtype

dict

returns

Response Syntax

{
    'NotebookInstanceLifecycleConfigArn': 'string',
    'NotebookInstanceLifecycleConfigName': 'string',
    'OnCreate': [
        {
            'Content': 'string'
        },
    ],
    'OnStart': [
        {
            'Content': 'string'
        },
    ],
    'LastModifiedTime': datetime(2015, 1, 1),
    'CreationTime': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • NotebookInstanceLifecycleConfigArn (string) --

      The Amazon Resource Name (ARN) of the lifecycle configuration.

    • NotebookInstanceLifecycleConfigName (string) --

      The name of the lifecycle configuration.

    • OnCreate (list) --

      The shell script that runs only once, when you create a notebook instance.

      • (dict) --

        Contains the notebook instance lifecycle configuration script.

        This script runs in the path /sbin:bin:/usr/sbin:/usr/bin .

        For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

        • Content (string) --

          A base64-encoded string that contains a shell script for a notebook instance lifecycle configuration.

    • OnStart (list) --

      The shell script that runs every time you start a notebook instance, including when you create the notebook instance.

      • (dict) --

        Contains the notebook instance lifecycle configuration script.

        This script runs in the path /sbin:bin:/usr/sbin:/usr/bin .

        For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

        • Content (string) --

          A base64-encoded string that contains a shell script for a notebook instance lifecycle configuration.

    • LastModifiedTime (datetime) --

      A timestamp that tells when the lifecycle configuration was last modified.

    • CreationTime (datetime) --

      A timestamp that tells when the lifecycle configuration was created.

CreateNotebookInstance (updated) Link ¶
Changes (request)
{'DirectInternetAccess': 'Enabled | Disabled',
 'InstanceType': {'ml.p3.2xlarge'},
 'LifecycleConfigName': 'string'}

Creates an Amazon SageMaker 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. Amazon SageMaker 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.

Amazon SageMaker also provides a set of example notebooks. Each notebook demonstrates how to use Amazon SageMaker with a specific algorithm or with a machine learning framework.

After receiving the request, Amazon SageMaker does the following:

  • Creates a network interface in the Amazon SageMaker VPC.

  • (Option) If you specified SubnetId , Amazon SageMaker 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, Amazon SageMaker 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 Amazon SageMaker VPC. If you specified SubnetId of your VPC, Amazon SageMaker 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, Amazon SageMaker returns its Amazon Resource Name (ARN).

After Amazon SageMaker 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 Amazon SageMaker endpoints, and validate hosted models.

For more information, see How It Works.

See also: AWS API Documentation

Request Syntax

client.create_notebook_instance(
    NotebookInstanceName='string',
    InstanceType='ml.t2.medium'|'ml.m4.xlarge'|'ml.p2.xlarge'|'ml.p3.2xlarge',
    SubnetId='string',
    SecurityGroupIds=[
        'string',
    ],
    RoleArn='string',
    KmsKeyId='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    LifecycleConfigName='string',
    DirectInternetAccess='Enabled'|'Disabled'
)
type NotebookInstanceName

string

param NotebookInstanceName

[REQUIRED]

The name of the new notebook instance.

type InstanceType

string

param InstanceType

[REQUIRED]

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

type SubnetId

string

param SubnetId

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

type SecurityGroupIds

list

param 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.

  • (string) --

type RoleArn

string

param RoleArn

[REQUIRED]

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.

type KmsKeyId

string

param 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.

type Tags

list

param Tags

A list of tags to associate with the notebook instance. You can add tags later by using the CreateTags API.

  • (dict) --

    Describes a tag.

    • Key (string) -- [REQUIRED]

      The tag key.

    • Value (string) -- [REQUIRED]

      The tag value.

type LifecycleConfigName

string

param LifecycleConfigName

The name of a lifecycle configuration to associate with the notebook instance. For information about lifestyle configurations, see notebook-lifecycle-config.

type DirectInternetAccess

string

param 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 appendix-notebook-and-internet-access. You can set the value of this parameter to Disabled only if you set a value for the SubnetId parameter.

rtype

dict

returns

Response Syntax

{
    'NotebookInstanceArn': 'string'
}

Response Structure

  • (dict) --

    • NotebookInstanceArn (string) --

      The Amazon Resource Name (ARN) of the notebook instance.

DescribeNotebookInstance (updated) Link ¶
Changes (response)
{'DirectInternetAccess': 'Enabled | Disabled',
 'InstanceType': {'ml.p3.2xlarge'},
 'NotebookInstanceLifecycleConfigName': 'string'}

Returns information about a notebook instance.

See also: AWS API Documentation

Request Syntax

client.describe_notebook_instance(
    NotebookInstanceName='string'
)
type NotebookInstanceName

string

param NotebookInstanceName

[REQUIRED]

The name of the notebook instance that you want information about.

rtype

dict

returns

Response Syntax

{
    'NotebookInstanceArn': 'string',
    'NotebookInstanceName': 'string',
    'NotebookInstanceStatus': 'Pending'|'InService'|'Stopping'|'Stopped'|'Failed'|'Deleting',
    'FailureReason': 'string',
    'Url': 'string',
    'InstanceType': 'ml.t2.medium'|'ml.m4.xlarge'|'ml.p2.xlarge'|'ml.p3.2xlarge',
    'SubnetId': 'string',
    'SecurityGroups': [
        'string',
    ],
    'RoleArn': 'string',
    'KmsKeyId': 'string',
    'NetworkInterfaceId': 'string',
    'LastModifiedTime': datetime(2015, 1, 1),
    'CreationTime': datetime(2015, 1, 1),
    'NotebookInstanceLifecycleConfigName': 'string',
    'DirectInternetAccess': 'Enabled'|'Disabled'
}

Response Structure

  • (dict) --

    • NotebookInstanceArn (string) --

      The Amazon Resource Name (ARN) of the notebook instance.

    • NotebookInstanceName (string) --

      Name of the Amazon SageMaker notebook instance.

    • NotebookInstanceStatus (string) --

      The status of the notebook instance.

    • FailureReason (string) --

      If status is failed, the reason it failed.

    • Url (string) --

      The URL that you use to connect to the Jupyter notebook that is running in your notebook instance.

    • InstanceType (string) --

      The type of ML compute instance running on the notebook instance.

    • SubnetId (string) --

      The ID of the VPC subnet.

    • SecurityGroups (list) --

      The IDs of the VPC security groups.

      • (string) --

    • RoleArn (string) --

      Amazon Resource Name (ARN) of the IAM role associated with the instance.

    • KmsKeyId (string) --

      AWS KMS key ID Amazon SageMaker uses to encrypt data when storing it on the ML storage volume attached to the instance.

    • NetworkInterfaceId (string) --

      Network interface IDs that Amazon SageMaker created at the time of creating the instance.

    • LastModifiedTime (datetime) --

      A timestamp. Use this parameter to retrieve the time when the notebook instance was last modified.

    • CreationTime (datetime) --

      A timestamp. Use this parameter to return the time when the notebook instance was created

    • NotebookInstanceLifecycleConfigName (string) --

      Returns the name of a notebook instance lifecycle configuration.

      For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

    • DirectInternetAccess (string) --

      Describes whether the notebook instance has internet access.

      For more information, see appendix-notebook-and-internet-access.

ListNotebookInstances (updated) Link ¶
Changes (request, response)
Request
{'NotebookInstanceLifecycleConfigNameContains': 'string'}
Response
{'NotebookInstances': {'InstanceType': {'ml.p3.2xlarge'},
                       'NotebookInstanceLifecycleConfigName': 'string'}}

Returns a list of the Amazon SageMaker notebook instances in the requester's account in an AWS Region.

See also: AWS API Documentation

Request Syntax

client.list_notebook_instances(
    NextToken='string',
    MaxResults=123,
    SortBy='Name'|'CreationTime'|'Status',
    SortOrder='Ascending'|'Descending',
    NameContains='string',
    CreationTimeBefore=datetime(2015, 1, 1),
    CreationTimeAfter=datetime(2015, 1, 1),
    LastModifiedTimeBefore=datetime(2015, 1, 1),
    LastModifiedTimeAfter=datetime(2015, 1, 1),
    StatusEquals='Pending'|'InService'|'Stopping'|'Stopped'|'Failed'|'Deleting',
    NotebookInstanceLifecycleConfigNameContains='string'
)
type NextToken

string

param NextToken

If the previous call to the ListNotebookInstances is truncated, the response includes a NextToken . You can use this token in your subsequent ListNotebookInstances request to fetch the next set of notebook instances.

Note

You might specify a filter or a sort order in your request. When response is truncated, you must use the same values for the filer and sort order in the next request.

type MaxResults

integer

param MaxResults

The maximum number of notebook instances to return.

type SortBy

string

param SortBy

The field to sort results by. The default is Name .

type SortOrder

string

param SortOrder

The sort order for results.

type NameContains

string

param NameContains

A string in the notebook instances' name. This filter returns only notebook instances whose name contains the specified string.

type CreationTimeBefore

datetime

param CreationTimeBefore

A filter that returns only notebook instances that were created before the specified time (timestamp).

type CreationTimeAfter

datetime

param CreationTimeAfter

A filter that returns only notebook instances that were created after the specified time (timestamp).

type LastModifiedTimeBefore

datetime

param LastModifiedTimeBefore

A filter that returns only notebook instances that were modified before the specified time (timestamp).

type LastModifiedTimeAfter

datetime

param LastModifiedTimeAfter

A filter that returns only notebook instances that were modified after the specified time (timestamp).

type StatusEquals

string

param StatusEquals

A filter that returns only notebook instances with the specified status.

type NotebookInstanceLifecycleConfigNameContains

string

param NotebookInstanceLifecycleConfigNameContains

A string in the name of a notebook instances lifecycle configuration associated with this notebook instance. This filter returns only notebook instances associated with a lifecycle configuration with a name that contains the specified string.

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'NotebookInstances': [
        {
            'NotebookInstanceName': 'string',
            'NotebookInstanceArn': 'string',
            'NotebookInstanceStatus': 'Pending'|'InService'|'Stopping'|'Stopped'|'Failed'|'Deleting',
            'Url': 'string',
            'InstanceType': 'ml.t2.medium'|'ml.m4.xlarge'|'ml.p2.xlarge'|'ml.p3.2xlarge',
            'CreationTime': datetime(2015, 1, 1),
            'LastModifiedTime': datetime(2015, 1, 1),
            'NotebookInstanceLifecycleConfigName': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      If the response to the previous ListNotebookInstances request was truncated, Amazon SageMaker returns this token. To retrieve the next set of notebook instances, use the token in the next request.

    • NotebookInstances (list) --

      An array of NotebookInstanceSummary objects, one for each notebook instance.

      • (dict) --

        Provides summary information for an Amazon SageMaker notebook instance.

        • NotebookInstanceName (string) --

          The name of the notebook instance that you want a summary for.

        • NotebookInstanceArn (string) --

          The Amazon Resource Name (ARN) of the notebook instance.

        • NotebookInstanceStatus (string) --

          The status of the notebook instance.

        • Url (string) --

          The URL that you use to connect to the Jupyter instance running in your notebook instance.

        • InstanceType (string) --

          The type of ML compute instance that the notebook instance is running on.

        • CreationTime (datetime) --

          A timestamp that shows when the notebook instance was created.

        • LastModifiedTime (datetime) --

          A timestamp that shows when the notebook instance was last modified.

        • NotebookInstanceLifecycleConfigName (string) --

          The name of a notebook instance lifecycle configuration associated with this notebook instance.

          For information about notebook instance lifestyle configurations, see notebook-lifecycle-config.

UpdateNotebookInstance (updated) Link ¶
Changes (request)
{'InstanceType': {'ml.p3.2xlarge'}}

Updates a notebook instance. NotebookInstance updates include upgrading or downgrading the ML compute instance used for your notebook instance to accommodate changes in your workload requirements. You can also update the VPC security groups.

See also: AWS API Documentation

Request Syntax

client.update_notebook_instance(
    NotebookInstanceName='string',
    InstanceType='ml.t2.medium'|'ml.m4.xlarge'|'ml.p2.xlarge'|'ml.p3.2xlarge',
    RoleArn='string'
)
type NotebookInstanceName

string

param NotebookInstanceName

[REQUIRED]

The name of the notebook instance to update.

type InstanceType

string

param InstanceType

The Amazon ML compute instance type.

type RoleArn

string

param RoleArn

Amazon Resource Name (ARN) of the IAM role to associate with the instance.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --