Skip to content
Open
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
11 changes: 7 additions & 4 deletions vast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,16 +1196,17 @@ def get_ssh_key(argstr):
@parser.command(
argument("instance_id", help="id of instance to attach to", type=int),
argument("ssh_key", help="ssh key to attach to instance", type=str),
usage="vastai attach instance_id ssh_key",
usage="vastai attach ssh instance_id ssh_key",
help="Attach an ssh key to an instance. This will allow you to connect to the instance with the ssh key",
epilog=deindent("""
Attach an ssh key to an instance. This will allow you to connect to the instance with the ssh key.

Examples:
vast attach 12371 ssh-rsa AAAAB3NzaC1yc2EAAA...
vast attach 12371 ssh-rsa $(cat ~/.ssh/id_rsa)
vast attach ssh 12371 AAAAB3NzaC1yc2EAAA...
vast attach ssh 12371 $(cat ~/.ssh/id_rsa.pub)
vast attach ssh 12371 ~/.ssh/id_rsa.pub

The first example attaches the ssh key to instance 12371
All examples attaches the ssh key to instance 12371
"""),
)
def attach__ssh(args):
Expand All @@ -1214,6 +1215,8 @@ def attach__ssh(args):
req_json = {"ssh_key": ssh_key}
r = http_post(args, url, headers=headers, json=req_json)
r.raise_for_status()
if args.raw:
return r
print(r.json())

@parser.command(
Expand Down