Each server has its own host and port, which change when it is recreated or moved. Instead of copying them every time, the apidly command can write them into your SSH config file. After that, ssh my-gpu works, and so do scp, rsync and editors that read ~/.ssh/config. You need the apidly command (see Use the CLI and API from scratch), a running server and your SSH key added under SSH keys (see Connect with SSH).
1. Look at the entries first
apidly ssh-configThis only prints, and changes nothing. For each running server that answers SSH you see an entry like this:
Host ins_abc123 my-gpu
HostName 203.0.113.10
Port 40022
User root
StrictHostKeyChecking accept-new
ServerAliveInterval 60The first name is the server id. The second is the server's label, in lower case with spaces and other characters turned into -. A label is added only when no other running server has the same one. If your private key is not in the default place, add -i ~/.ssh/your_key: each entry then gets an IdentityFile line.
2. Write them into your SSH config
apidly ssh-config --writeYou see Wrote 1 server to …/.ssh/config. Connect with ssh my-gpu. The entries go into one marked block:
# >>> apidly servers (written by `apidly ssh-config --write`; edits inside are replaced) >>>
…
# <<< apidly servers <<<Everything outside the block is kept as it was. Do not edit inside it: the next run replaces the whole block. To write another file, add --file PATH.
3. Connect by name
ssh my-gpu
scp results.csv my-gpu:/workspace/
rsync -av ./data/ my-gpu:/workspace/data/The first time, ssh accepts the server's host key on its own (StrictHostKeyChecking accept-new), and it refuses a changed key later. In VS Code or Cursor, the server appears under Remote-SSH by the same name.
4. Run it again when servers change
Only running servers are written. After you start, stop, recreate or deploy a server, run apidly ssh-config --write again so the block matches.
Remove the block
Stop the servers you no longer need, then run apidly ssh-config --write. When no server is running, it removes the apidly block and says so. You can also delete the lines from # >>> apidly servers to # <<< apidly servers <<< in ~/.ssh/config by hand; nothing else depends on them.
What it costs and how to stop spending
Writing the config costs nothing. The server you connect to is billed by the second while it runs. When you are done, stop it with apidly stop ins_ID (the disk is still charged) or destroy it with apidly destroy ins_ID.
Next
Ready to try it?
Create a free account and add credit when you want to start a server. The smallest top-up is $10.
Was this helpful?