# Zero-Deploy RPyC

Added in version 3.3.

Requires [plumbum](http://plumbum.readthedocs.org/)

class rpyc.utils.zerodeploy.DeployedServer(remote_machine, server_class='rpyc.utils.server.ThreadedServer', extra_setup='', python_executable=None)

  Sets up a temporary, short-lived RPyC deployment on the given remote machine. It will:

  1. Create a temporary directory on the remote machine and copy RPyC’s code from the local machine to the remote temporary directory.

  2. Start an RPyC server on the remote machine, binding to an arbitrary TCP port, allowing only in-bound connections (`localhost` connections). The server reports the chosen port over `stdout`.

  3. An SSH tunnel is created from an arbitrary local port (on the local host), to the remote machine’s chosen port. This tunnel is authenticated and encrypted.

  4. You get a `DeployedServer` object that can be used to connect to the newly-spawned server.

  5. When the deployment is closed, the SSH tunnel is torn down, the remote server terminates and the temporary directory is deleted.

  Parameters:

    - remote_machine – a plumbum `SshMachine` or `ParamikoMachine` instance, representing an SSH connection to the desired remote machine

    - server_class – the server to create (e.g., `"ThreadedServer"`, `"ForkingServer"`)

    - extra_setup – any extra code to add to the script

  connect(service=<class 'rpyc.core.service.VoidService'>, config={})

    Same as `connect()`, but with the `host` and `port` parameters fixed

  classic_connect()

    Same as `classic.connect`, but with the `host` and `port` parameters fixed

class rpyc.utils.zerodeploy.MultiServerDeployment(remote_machines, server_class='rpyc.utils.server.ThreadedServer')

  An ‘aggregate’ server deployment to multiple SSH machine. It deploys RPyC to each machine separately, but lets you manage them as a single deployment.

  connect_all(service=<class 'rpyc.core.service.VoidService'>, config={})

    connects to all deployed servers; returns a list of connections (order guaranteed)

  classic_connect_all()

    connects to all deployed servers using classic_connect; returns a list of connections (order guaranteed)