https://github.com/vinc/closh
🖥️ Get a shell running in the cloud in seconds
https://github.com/vinc/closh
cloud shell
Last synced: 2 months ago
JSON representation
🖥️ Get a shell running in the cloud in seconds
- Host: GitHub
- URL: https://github.com/vinc/closh
- Owner: vinc
- License: mit
- Created: 2017-10-09T17:53:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-28T13:36:30.000Z (almost 8 years ago)
- Last Synced: 2025-10-27T00:48:50.116Z (8 months ago)
- Topics: cloud, shell
- Language: Ruby
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Cloud Shell
===========
[](https://rubygems.org/gems/closh)
[](https://travis-ci.org/vinc/closh/branches)
[](https://gemnasium.com/github.com/vinc/closh)
Get a shell running in the cloud in seconds
[](https://asciinema.org/a/146126)
Installation
------------
$ gem install closh
Alternatively you can build the gem from its repository:
$ git clone git://github.com/vinc/closh.git
$ cd closh
$ gem build closh.gemspec
$ gem install closh-0.0.1.gem
Usage
-----
Run a command in the cloud:
$ closh -x "cut -d . -f 1 /proc/uptime"
23
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@158.116.77.89' ...
debug: executing command 'cut -d . -f 1 /proc/uptime' ...
23
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" < example.sh
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 158.116.77.89 "tail -f screenlog.0"
More options:
$ closh -h
Usage: closh
Cloud Shell v0.0.1
Options:
-n, --dry-run Create fake server and run locally
-c, --config= Config file (default: ~/.closh.yml)
-k, --key= SSH public key (default: ~/.ssh/id_rsa.pub)
-r, --resume= 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
Configure
---------
Cloud Shell is based on [Fog](http://fog.io/) 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 `Fog::Compute.new` and
the latter to `Fog::Compute::*::Server.new`.
```yaml
---
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
server:
image_id: ami-b04847cf # Ubuntu 18.04 LTS
flavor_id: t2.micro
username: ubuntu
groups:
- default
- ssh
```
License
-------
Copyright (c) 2017-2018 Vincent Ollivier. Released under MIT.