Skip to main content

SageMaker Studio CLI

SageMaker Studio CLI is an open source command-line utility for interacting with Amazon SageMaker Unified Studio. With this CLI, you can access SageMaker Unified Studio resources and run both local and remote executions.

Table of Contents

  1. Installation
  2. Usage
    1. Setting up Credentials
      1. AWS Named Profile
    2. Commands
      1. credentials
        1. get-domain-execution-role-credential-in-space
      2. project
        1. get-project-default-environment
      3. git
        1. get-clone-url
      4. execution
        1. start
        2. get
        3. list
        4. stop

1) Installation

The SageMaker Studio CLI is built to PyPI, and the latest version of the CLI can be installed using the following command:

pip install sagemaker-studio

Supported Python Versions

SageMaker Studio CLI supports Python versions 3.9 and newer.

Licensing

SageMaker Studio CLI is licensed under the Apache 2.0 License. It is copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. The license is available at: http://aws.amazon.com/apache2.0/

2) Usage

Setting Up Credentials

If SageMaker Studio CLI is being used within SageMaker Unified Studio JupyterLab, the CLI will automatically pull your latest credentials from the environment.

If you are using the CLI elsewhere, or if you want to use different credentials within SageMaker Unified Studio JupyterLab, you will need to first retrieve your SageMaker Unified Studio credentials and make them available in the environment by storing them within an AWS named profile. If you are using a profile name other than default, you need to supply the profile name using one of the following methods:

  1. Supplying it as part of your CLI command (e.g. --profile my_profile_name)
  2. Setting the AWS profile name as an environment variable (e.g. export AWS_PROFILE="my_profile_name")
AWS Named Profile

To create an AWS named profile, you can update your AWS config file with your profile name and any other settings you would like to use:

[my_profile_name]
region = us-east-1

Your credentials file should have the credentials stored for your profile:

[my_profile_name]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
aws_session_token=IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE

Finally, you can use this profile my_profile_name through any of the three methods listed in the above section.

Commands

SageMaker Studio CLI has several commands that you can use to interact with your resources within SageMaker Unified Studio.

credentials

get-domain-execution-role-credential-in-space

The following command prints domain execution role credentials for a space.

sagemaker-studio credentials get-domain-execution-role-credential-in-space --domain-id <domain_id>

project

get-project-default-environment

The following command prints the details of the default environment within your project.

sagemaker-studio project get-project-default-environment --project-id <project_id> --domain-id <domain_id>

git

get-clone-url

The following command prints the clone URL for the project's Git repository.

sagemaker-studio git get-clone-url --project-id <project_id> --domain-id <domain_id>

execution

start

The following command starts an execution in the user's space.

sagemaker-studio execution start --execution-name <execution-name> --input-config '{ "notebook_config": { "input_path": <input_path_relative to user's home directory> } } '

To start the execution on remote compute, pass the --remote flag and other required parameters like --compute in the following command.

sagemaker-studio execution start --remote --execution-name <execution-name> --input-config '{ "notebook_config": { "input_path": <input_path_relative to user's home directory> } } ' --compute '{ "instance_type": "ml.c4.2xlarge", "image_details": { "image_name": "sagemaker-distribution-embargoed-prod", "image_version": "3.0" }}'
get

The following command gets details of an execution running in the user's space.

sagemaker-studio execution get --execution-id <execution-id>

To get the details of an execution running on remote compute, pass the --remote flag in the following command.

sagemaker-studio execution get --execution-id <execution-id> --remote
list

The following command lists executions running in the user's space.

sagemaker-studio execution list

The following optional filters are supported:

  • --name-contains <name>
  • --status valid values: ['IN_PROGRESS', 'COMPLETED', 'FAILED', 'STOPPING', 'STOPPED']
  • --sort-by valid values: ['NAME', 'STATUS', 'START_TIME', 'END_TIME']
  • --sort-order valid values: ['ASCENDING', 'DESCENDING']
  • --start-time-after <timestamp_in_millis>
  • --next-token <next_token>
  • --max-items <int>
sagemaker-studio execution list --name-contains "asdf" --status COMPLETED --sort-order ASCENDING --start-time-after 1730327776000

To list executions running on remote compute, pass the --remote flag in the following command.

sagemaker-studio execution list --remote --name-contains "asdf" --status COMPLETED --sort-order ASCENDING --start-time-after 1730327776000

The following optional filters are supported:

  • --name-contains <name>
  • --status valid values: ['IN_PROGRESS', 'COMPLETED', 'FAILED', 'STOPPING', 'STOPPED']
  • --sort-by valid values: ['NAME', 'STATUS', 'START_TIME', 'END_TIME']
  • --sort-order valid values: ['ASCENDING', 'DESCENDING']
  • --start-time-after <timestamp_in_millis>
  • --next-token <next_token>
  • --max-items <int>
  • --filter-by-tags <dict>
stop

The following command stops an execution running in the user's space.

sagemaker-studio execution stop --execution-id <execution-id>

To stop an execution running on remote compute, pass the --remote flag in the following command.

sagemaker-studio execution stop --execution-id <execution-id> --remote

Metadata

Release files for sagemaker-studio-cli 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sagemaker-studio-cli 1.0.7
File Size Uploaded Provenance Actions
sagemaker_studio_cli-1.0.7.tar.gz 17.3 kB Without provenance Details for sagemaker_studio_cli-1.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sagemaker-studio-cli 1.0.7
File Interpreter ABI Platform Actions
sagemaker_studio_cli-1.0.7-py3-none-any.whl Python 3 none any Details for sagemaker_studio_cli-1.0.7-py3-none-any.whl

Total release size: 34.0 kB

Release files / sagemaker_studio_cli-1.0.7.tar.gz

Download URL sagemaker_studio_cli-1.0.7.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aebc58e09fe6d2a1c8573b3985ace9cc26e9a51403a3c3dc01a0a29c50cd7832
BLAKE2b-256 checksum
How to use checksums
25b7113ce82e69a982210c0bf6bad53c10cd44e417920b92208b01d75375b7bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / sagemaker_studio_cli-1.0.7-py3-none-any.whl

Download URL sagemaker_studio_cli-1.0.7-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ade8cae05aa4be998f1c9acdd5220693eea34d4c9f21df5da06ba4ba7b24c50
BLAKE2b-256 checksum
How to use checksums
059c8d8a84d42ca3039b12755fb7d66eac74d1557eb1614648beee709415fe34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for sagemaker-studio-cli 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page