# 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](#installation)
2. [Usage](#usage)
1. [Setting up Credentials](#setting-up-credentials)
1. [AWS Named Profile](#aws-named-profile)
2. [Commands](#commands)
1. [credentials](#credentials)
1. [get-domain-execution-role-credential-in-space](#get-domain-execution-role-credential-in-space)
2. [project](#project)
1. [get-project-default-environment](#get-project-default-environment)
3. [git](#git)
1. [get-clone-url](#get-clone-url)
4. [execution](#execution)
1. [start](#start)
2. [get](#get)
3. [list](#list-1)
4. [stop](#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:
```bash
pip install sagemaker-studio
```
#### Supported Python Versions
SageMaker Studio CLI supports Python versions 3.11 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](https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html). 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:
```config
[my_profile_name]
region = us-east-1
```
Your `credentials` file should have the credentials stored for your profile:
```config
[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.
```bash
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.
```bash
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.
```bash
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.
```bash
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.
```bash
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.
```bash
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.
```bash
sagemaker-studio execution get --execution-id <execution-id> --remote
```
##### list
The following command lists executions running in the user's space.
```bash
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>`
```bash
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.
```bash
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.
```bash
sagemaker-studio execution stop --execution-id <execution-id>
```
To stop an execution running on remote compute, pass the `--remote` flag in the following command.
```bash
sagemaker-studio execution stop --execution-id <execution-id> --remote
```
Raw data
{
"_id": null,
"home_page": "https://aws.amazon.com/sagemaker/",
"name": "sagemaker-studio-cli",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "AWS, Amazon, SageMaker, SageMaker Unified Studio, CLI",
"author": "Amazon Web Services",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9b/14/b5da9bb736548b52a0ea7cd954939eaab24e497abfe2c3ebb4c996924ef5/sagemaker_studio_cli-1.0.3.tar.gz",
"platform": "Linux",
"description": "# SageMaker Studio CLI\n\nSageMaker 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.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n 1. [Setting up Credentials](#setting-up-credentials)\n 1. [AWS Named Profile](#aws-named-profile)\n 2. [Commands](#commands)\n 1. [credentials](#credentials)\n 1. [get-domain-execution-role-credential-in-space](#get-domain-execution-role-credential-in-space)\n 2. [project](#project)\n 1. [get-project-default-environment](#get-project-default-environment)\n 3. [git](#git)\n 1. [get-clone-url](#get-clone-url)\n 4. [execution](#execution)\n 1. [start](#start)\n 2. [get](#get)\n 3. [list](#list-1)\n 4. [stop](#stop)\n\n## 1) Installation\n\nThe SageMaker Studio CLI is built to PyPI, and the latest version of the CLI can be installed using the following command:\n\n```bash\npip install sagemaker-studio\n```\n\n#### Supported Python Versions\nSageMaker Studio CLI supports Python versions 3.11 and newer.\n\n\n#### Licensing\n\nSageMaker 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/\n\n\n## 2) Usage\n\n### Setting Up Credentials\n\nIf SageMaker Studio CLI is being used within SageMaker Unified Studio JupyterLab, the CLI will automatically pull your latest credentials from the environment.\n\nIf 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](https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html). If you are using a profile name other than `default`, you need to supply the profile name using one of the following methods:\n1. Supplying it as part of your CLI command (e.g. `--profile my_profile_name`)\n2. Setting the AWS profile name as an environment variable (e.g. `export AWS_PROFILE=\"my_profile_name\"`)\n\n##### AWS Named Profile\n\nTo 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:\n\n```config\n[my_profile_name]\nregion = us-east-1\n```\n\nYour `credentials` file should have the credentials stored for your profile:\n\n```config\n[my_profile_name]\naws_access_key_id=AKIAIOSFODNN7EXAMPLE\naws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\naws_session_token=IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE\n```\n\nFinally, you can use this profile `my_profile_name` through any of the three methods listed in the above section.\n\n\n### Commands\n\nSageMaker Studio CLI has several commands that you can use to interact with your resources within SageMaker Unified Studio.\n\n\n#### credentials\n\n\n##### get-domain-execution-role-credential-in-space\n\nThe following command prints domain execution role credentials for a space.\n\n```bash\nsagemaker-studio credentials get-domain-execution-role-credential-in-space --domain-id <domain_id>\n```\n\n\n#### project\n\n##### get-project-default-environment\n\nThe following command prints the details of the default environment within your project.\n\n```bash\nsagemaker-studio project get-project-default-environment --project-id <project_id> --domain-id <domain_id>\n```\n\n\n#### git\n\n##### get-clone-url\n\nThe following command prints the clone URL for the project's Git repository.\n\n```bash\nsagemaker-studio git get-clone-url --project-id <project_id> --domain-id <domain_id>\n```\n\n\n#### execution\n\n##### start\n\nThe following command starts an execution in the user's space.\n\n```bash\nsagemaker-studio execution start --execution-name <execution-name> --input-config '{ \"notebook_config\": { \"input_path\": <input_path_relative to user's home directory> } } ' \n```\n\nTo start the execution on remote compute, pass the `--remote` flag and other required parameters like `--compute` in the following command.\n```bash\nsagemaker-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\" }}' \n```\n\n##### get\nThe following command gets details of an execution running in the user's space.\n```bash\nsagemaker-studio execution get --execution-id <execution-id>\n```\nTo get the details of an execution running on remote compute, pass the `--remote` flag in the following command.\n```bash\nsagemaker-studio execution get --execution-id <execution-id> --remote\n```\n\n##### list\nThe following command lists executions running in the user's space.\n```bash\nsagemaker-studio execution list\n```\n\nThe following optional filters are supported:\n- `--name-contains <name>`\n- `--status` valid values: ['IN_PROGRESS', 'COMPLETED', 'FAILED', 'STOPPING', 'STOPPED']\n- `--sort-by` valid values: ['NAME', 'STATUS', 'START_TIME', 'END_TIME']\n- `--sort-order` valid values: ['ASCENDING', 'DESCENDING']\n- `--start-time-after <timestamp_in_millis>`\n- `--next-token <next_token>`\n- `--max-items <int>`\n\n```bash\nsagemaker-studio execution list --name-contains \"asdf\" --status COMPLETED --sort-order ASCENDING --start-time-after 1730327776000\n```\n\nTo list executions running on remote compute, pass the `--remote` flag in the following command.\n```bash\nsagemaker-studio execution list --remote --name-contains \"asdf\" --status COMPLETED --sort-order ASCENDING --start-time-after 1730327776000\n```\nThe following optional filters are supported:\n- `--name-contains <name>`\n- `--status` valid values: ['IN_PROGRESS', 'COMPLETED', 'FAILED', 'STOPPING', 'STOPPED']\n- `--sort-by` valid values: ['NAME', 'STATUS', 'START_TIME', 'END_TIME']\n- `--sort-order` valid values: ['ASCENDING', 'DESCENDING']\n- `--start-time-after <timestamp_in_millis>`\n- `--next-token <next_token>`\n- `--max-items <int>`\n- `--filter-by-tags <dict>`\n\n##### stop\nThe following command stops an execution running in the user's space.\n```bash\nsagemaker-studio execution stop --execution-id <execution-id>\n```\nTo stop an execution running on remote compute, pass the `--remote` flag in the following command.\n```bash\nsagemaker-studio execution stop --execution-id <execution-id> --remote\n```\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "CLI to interact with SageMaker Studio",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://aws.amazon.com/sagemaker/"
},
"split_keywords": [
"aws",
" amazon",
" sagemaker",
" sagemaker unified studio",
" cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ce9e9b07b8c24b0d6160d7c846e9a9175fa1f43ff32ffac48de91e06a5af34dd",
"md5": "27fb957c354195154a5444928facaeac",
"sha256": "d7bc7f336267dd0560729b300b9d4ab9591ccc4d6f6e7eb0357c8a5c4f1a5de1"
},
"downloads": -1,
"filename": "sagemaker_studio_cli-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "27fb957c354195154a5444928facaeac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 16533,
"upload_time": "2025-02-11T21:00:59",
"upload_time_iso_8601": "2025-02-11T21:00:59.103773Z",
"url": "https://files.pythonhosted.org/packages/ce/9e/9b07b8c24b0d6160d7c846e9a9175fa1f43ff32ffac48de91e06a5af34dd/sagemaker_studio_cli-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9b14b5da9bb736548b52a0ea7cd954939eaab24e497abfe2c3ebb4c996924ef5",
"md5": "67430ee820f47d91d2ec9a9cc45783ec",
"sha256": "c206db686add9c7342cee593129b98fedf264e63d1f61777b724ba4ab2263a32"
},
"downloads": -1,
"filename": "sagemaker_studio_cli-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "67430ee820f47d91d2ec9a9cc45783ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 22885,
"upload_time": "2025-02-11T21:01:01",
"upload_time_iso_8601": "2025-02-11T21:01:01.637237Z",
"url": "https://files.pythonhosted.org/packages/9b/14/b5da9bb736548b52a0ea7cd954939eaab24e497abfe2c3ebb4c996924ef5/sagemaker_studio_cli-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 21:01:01",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "sagemaker-studio-cli"
}