Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,17 @@ hyp create hyp-space \
#### List Spaces

```bash
# List spaces in default namespace
hyp list hyp-space

# List spaces in specific namespace
hyp list hyp-space --namespace my-namespace

# List spaces across all namespaces
hyp list hyp-space --all-namespaces

# List spaces with JSON output
hyp list hyp-space --output json
```

#### Describe a Space
Expand Down Expand Up @@ -742,13 +752,27 @@ hyp get-logs hyp-space --name myspace
hyp delete hyp-space --name myspace
```

#### Port Forward to a Space

Port forward to access a space from your local machine:

```bash
# Port forward with default port (8888)
hyp portforward hyp-space --name myspace

# Port forward with custom local port
hyp portforward hyp-space --name myspace --local-port 8080
```

Access the space via `http://localhost:<local-port>` after port forwarding is established. Press Ctrl+C to stop port forwarding.

#### Space Template Management

Create reusable space templates:

```bash
hyp create hyp-space-template --file template.yaml
hyp list hyp-space-template
hyp list hyp-space-template --all-namespaces
hyp describe hyp-space-template --name <template-name>
hyp update hyp-space-template --name <template-name> --file updated-template.yaml
hyp delete hyp-space-template --name <template-name>
Expand Down Expand Up @@ -1283,6 +1307,23 @@ space = HPSpace.get(name="myspace")
space.delete()
```

#### Port Forward to a Space

```python
from sagemaker.hyperpod.space.hyperpod_space import HPSpace

# Get existing space
space = HPSpace.get(name="myspace")

# Port forward with default remote port (8888)
space.portforward_space(local_port="8080")

# Port forward with custom remote port
space.portforward_space(local_port="8080", remote_port="8888")
```

Access the space via `http://localhost:<local-port>` after port forwarding is established. Press Ctrl+C to stop port forwarding.

#### Space Template Management

```python
Expand Down
52 changes: 49 additions & 3 deletions doc/cli/space/cli_space.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Complete reference for Amazon SageMaker Space management commands and configurat
* [Start Space](#hyp-start-hyp-space)
* [Stop Space](#hyp-stop-hyp-space)
* [Get Logs](#hyp-get-logs-hyp-space)
* [Port Forward](#hyp-portforward-hyp-space)
* [Create Space Access](#hyp-create-hyp-space-access)
* [Create Space Template](#hyp-create-hyp-space-template)
* [List Space Templates](#hyp-list-hyp-space-template)
Expand Down Expand Up @@ -76,7 +77,7 @@ Commands for managing Amazon SageMaker Spaces.

### hyp list hyp-space

List all spaces in a namespace.
List all spaces in a namespace or across all namespaces.

#### Syntax

Expand All @@ -89,12 +90,23 @@ hyp list hyp-space [OPTIONS]
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `--namespace, -n` | TEXT | No | Kubernetes namespace (default: "default") |
| `--all-namespaces, -A` | FLAG | No | List spaces across all namespaces |
| `--output, -o` | TEXT | No | Output format: table or json (default: "table") |

#### Example
#### Examples

```bash
hyp list hyp-space --namespace default --output table
# List spaces in default namespace
hyp list hyp-space

# List spaces in specific namespace
hyp list hyp-space --namespace my-namespace

# List spaces across all namespaces
hyp list hyp-space --all-namespaces

# List spaces with JSON output
hyp list hyp-space --output json
```

### hyp describe hyp-space
Expand Down Expand Up @@ -261,6 +273,39 @@ hyp get-logs hyp-space [OPTIONS]
hyp get-logs hyp-space --name my-space --namespace default --pod-name my-pod
```

### hyp portforward hyp-space

Port forward to a space resource for local development access.

#### Syntax

```bash
hyp portforward hyp-space [OPTIONS]
```

#### Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `--name` | TEXT | Yes | Name of the space to port forward to |
| `--namespace, -n` | TEXT | No | Kubernetes namespace (default: "default") |
| `--local-port` | TEXT | No | Local port to forward from (default: "8888") |

#### Examples

```bash
# Port forward with default port (8888)
hyp portforward hyp-space --name my-space

# Port forward with custom local port
hyp portforward hyp-space --name my-space --local-port 8080

# Port forward to space in specific namespace
hyp portforward hyp-space --name my-space --namespace my-namespace --local-port 8080
```

Access the space via `http://localhost:<local-port>` after port forwarding is established. Press Ctrl+C to stop port forwarding.

## Space Access Commands

Commands for managing space access resources.
Expand Down Expand Up @@ -330,6 +375,7 @@ hyp list hyp-space-template [OPTIONS]
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `--namespace, -n` | TEXT | No | Kubernetes namespace |
| `--all-namespaces, -A` | FLAG | No | List spaces across all namespaces |
| `--output, -o` | TEXT | No | Output format: table or json (default: "table") |

#### Example
Expand Down
Loading