一键导入
vscode
Connect local desktop VS Code to a sandbox via SSM port-forward + per-sandbox ed25519 keypair; rotate keys without destroying the sandbox
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Connect local desktop VS Code to a sandbox via SSM port-forward + per-sandbox ed25519 keypair; rotate keys without destroying the sandbox
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | vscode |
| description | Connect local desktop VS Code to a sandbox via SSM port-forward + per-sandbox ed25519 keypair; rotate keys without destroying the sandbox |
Operator-side workflow for connecting desktop VS Code into a sandbox over SSM + ssh. km generates a per-sandbox ed25519 keypair on the operator workstation, ships the public key via userdata, and writes an ~/.ssh/config Host entry that tunnels through aws ssm start-session.
Audience: the operator running km on their workstation. The sandbox just needs runtime.vscode.enabled: true in its profile (the default).
klanker:init — must run km init --sidecars once before VS Code support works for new sandboxesklanker:user — km create, km list, km destroy lifecycleField (under spec.runtime.vscode) | Type | Default | Purpose |
|---|---|---|---|
enabled | bool* | true | Provision sshd + authorized_keys at sandbox boot. Set false to skip. |
Phase 92 moved this field from spec.cli.vscodeEnabled to spec.runtime.vscode.enabled; the old path is rejected by km validate.
bool* = pointer-bool with profile-inheritance semantics; omit to use parent/default.
| Path | Purpose |
|---|---|
~/.km/keys/<sandbox-id> | Private key (mode 0600) generated by km create |
~/.km/keys/<sandbox-id>.pub | Public key (mode 0644) shipped via userdata |
~/.ssh/config (managed block) | Host entries between # BEGIN km vscode hosts and # END km vscode hosts markers |
VSCodeSSHPubKey userdata field):make build
km init --sidecars
Without km init --sidecars, km create --remote against a runtime.vscode.enabled profile produces a sandbox with broken authorized_keys (silent SSH failure).
# 1. Create — keypair is generated locally
km create profiles/<your-profile>.yaml --alias my-poc
# 2. Resolve the sandbox ID
SB=$(km list | awk '/my-poc/ {print $1}')
# 3. Open the SSM tunnel (blocks until Ctrl-C)
km vscode start $SB
# 4. In VS Code: F1 → "Remote-SSH: Connect to Host..." → km-$SB
# 5. (Optional) check sshd + authorized_keys state on the sandbox
km vscode status $SB
# 6. Teardown also cleans the local keypair + ssh-config block
km destroy $SB --remote --yes
km vscode start and km vscode status accept the same identifier formats as other km subcommands: full sandbox ID (lrn2-ee9499b5), alias (my-poc), or the row number from km list.
--local-port <N> overrides the default 2222 if it's already in use.
km vscode rekey <sandbox-id> --yes
Generates a fresh ed25519 pair on the operator workstation, pushes the new public key to the sandbox's ~/.ssh/authorized_keys, and rewrites the local ~/.ssh/config block. Active VS Code sessions stay on the old key until reconnect.
Solves:
authorized_keys from the bake-time sandbox.km vscode rekey on a second laptop bootstraps a fresh key without manual file copy.Pre-flight gates (any failure = no key changes):
running (not stopped / pending)km lock must not block (override with --force)runtime.vscode.enabled: true — sandboxes created without it get a clear hard error pointing at km destroy && km createruntime.vscode.enabled: true do NOT get sshd retroactively. km destroy && km create to provision.km vscode start from a different laptop must run km vscode rekey there, OR manually copy ~/.km/keys/<sandbox-id>* from the original laptop.km destroy cleans up the local keypair files AND the ssh-config Host block. Manual cleanup is only needed when a sandbox is wiped out-of-band (region deleted, DynamoDB row removed, etc.).See docs/vscode.md for the full operator guide and troubleshooting matrix.
Post messages from inside a sandbox to its per-sandbox Slack channel using km-slack — for end-of-task status, progress notes, operator pings, threaded transcript replies, and Block-Kit-rendered output
Operator CLI guide for the km command — creating sandboxes, running agents, learning traffic, managing lifecycle
Self-census: identity, capabilities, network position, privilege/restrictions, Slack readiness, posture summary
One-time platform setup for an operator workstation — km configure, km init, multi-instance resource_prefix isolation, Slack/Lambda bootstrap, and rollout sequences after sidecar/Lambda changes
Launch a KasmVNC graphical browser session (kiosk or full XFCE) inside a sandbox EC2 and tunnel it to the operator's local browser over SSM port-forward
Provision cross-account IAM roles in the klanker AWS account that trust k8s clusters in other AWS accounts via IRSA (projected ServiceAccount tokens, auto-rotating 3600s sessions)