Cloud Shell

Gem Travis branch Gemnasium

Get a shell running in the cloud in seconds



$ gem install closh

Alternatively you can build the gem from its repository:

$ git clone git://
$ cd closh
$ gem build closh.gemspec
$ gem install closh-0.0.1.gem


Run a command in the cloud:

$ closh -x "cut -d . -f 1 /proc/uptime"

More verbose:

$ closh -vx "cut -d . -f 1 /proc/uptime"
debug: uploading SSH public key to AWS ...
debug: creating server on AWS ...
debug: connecting to 'ubuntu@' ...
debug: executing command 'cut -d . -f 1 /proc/uptime' ...
debug: destroying server ...

Pipe to stdin:

$ echo "cut -d . -f 1 /proc/uptime" | closh -x "bash -s"

Run a script remotely:

$ closh -x "bash -s" <

Skip the -x flag to keep a session alive for long running scripts.

Use -l to list sessions and -r to resume one:

$ closh -r "tail -f screenlog.0"

More options:

$ closh -h
Usage: closh <command>

Cloud Shell v0.0.1
  -n, --dry-run       Create fake server and run locally
  -c, --config=<s>    Config file (default: ~/.closh.yml)
  -k, --key=<s>       SSH public key (default: ~/.ssh/
  -r, --resume=<s>    Resume session
  -x, --kill          Kill session at the end
  -l, --list          List sessions
  -v, --verbose       Use verbose mode
  -h, --help          Show this message
  -V, --version       Print version and exit


Cloud Shell is based on Fog under the hood to create compute servers.

The configuration is stored in a YAML file (~/.closh.yml). It is divided in two parts: compute and server. The former being fed to and the latter to Fog::Compute::*


  provider: AWS
  aws_access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %>
  aws_secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %>
  region: us-east-1

  image_id: ami-b04847cf # Ubuntu 18.04 LTS
  flavor_id: t2.micro
  username: ubuntu
    - default
    - ssh


Copyright (c) 2017-2018 Vincent Ollivier. Released under MIT.