Skip to content

2.3 Configuring remote servers over SSH

Aliaksandr Krasitski edited this page Jun 10, 2016 · 3 revisions

Configuring remote servers over SSH

The SDK provides functionality for configuring created servers or executing Bash commands remotely over SSH (see the example below).

serverService.execSsh(server)
    .run(shellCommand1)
    .run(shellCommand2)
    .execute()
    .waitUntilComplete();

serverService.execSsh(server)
    .runScript(pathToFile)
    .execute()
    .waitUntilComplete();

SSH config could be specified: use internal IP or not (false by default), specify concrete server IP.

SshConnectionConfig sshConnectionConfig = new SshConnectionConfig()
    .useInternalIp()
    .ip("88.48.161.210");

serverService.execSsh(server, sshConnectionConfig)
    .run(shellCommand1)
    .run(shellCommand2)
    .execute()
    .waitUntilComplete();