feat: add hyp ssh command for direct terminal SSH into HyperPod spaces#420
Open
arkaprava08 wants to merge 1 commit into
Open
feat: add hyp ssh command for direct terminal SSH into HyperPod spaces#420arkaprava08 wants to merge 1 commit into
arkaprava08 wants to merge 1 commit into
Conversation
Add 'hyp ssh hyp-space --name <workspace>' command that establishes an interactive SSH session to a HyperPod Space via AWS Systems Manager (SSM) Session Manager. This extends the existing vscode-remote/kiro-remote space access mechanism to support direct terminal SSH without requiring any IDE. The command: 1. Verifies the space exists and is in Available status 2. Creates a WorkspaceConnection CRD with 'ssh-remote' connection type 3. Parses the returned connection URL for the SSM managed instance target 4. Invokes 'aws ssm start-session' as an interactive subprocess Also adds: - ssh() SDK method on HPSpace class - Unit tests for URL parsing and CLI command - Design document X-AI-Tool: Kiro (MeshClaw) X-AI-Prompt: Implement hyp ssh command for direct terminal SSH into HyperPod notebook spaces via SSM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Design:
hyp ssh— Direct Terminal SSH into HyperPod SpacesOverview
Add a
hyp ssh hyp-space --name <workspace>command that establishes an interactive SSH session to a HyperPod Space (notebook workspace) via AWS Systems Manager (SSM) Session Manager.Today, the CLI supports
vscode-remoteandkiro-remoteconnection types which open IDE-specific protocol URLs. This feature extends that to provide a direct terminal SSH experience without requiring any IDE.User Experience
Output:
Architecture
Flow
HPSpace.get(name)to verify the space exists and is Availablespace.create_space_access(connection_type="ssh-remote")which creates aWorkspaceConnectionCRDworkspaceConnectionUrlfrom the CRD status to extract the SSM target IDaws ssm start-session --target <instance-id> --region <region>as a subprocessConnection URL Format
The
workspaceConnectionUrlreturned by the operator forssh-remotetype:Or alternatively:
Implementation
New Files
src/sagemaker/hyperpod/cli/commands/ssh.pytest/unit_tests/cli/test_ssh.pyModified Files
src/sagemaker/hyperpod/cli/hyp_cli.pysshcommand groupsrc/sagemaker/hyperpod/space/hyperpod_space.pyssh()SDK methodKey Design Decisions
Reuse
create_space_accesswithssh-remotetype — No new CRD or API needed. The existingWorkspaceConnectionCRD supports arbitrary{ide}-remotepatterns. We usessh-remoteas the connection type.SSM as transport — HyperPod doesn't expose SSH ports. The Spaces operator registers an SSM Advanced On-Premises Instance for each space. This is the same mechanism used by
vscode-remote.Subprocess for session — We use
subprocess.run()with stdin/stdout/stderr passthrough for a fully interactive terminal. This is the same pattern used byaws ssm start-sessiondirectly.No SSH key management — SSM handles authentication via IAM. No SSH keys needed.
Prerequisites
ssm:StartSessionpermissionAvailablestatus (running)SDK Usage
Testing
hyp ssh hyp-space --name <space> --debugshows the SSM commandFuture Extensions
hyp ssh hyp-space --name ws --command "nvidia-smi"— run a single commandhyp scp— file transfer via SSM~/.ssh/configProxyCommand integration