README
      ¶
    
    
      Scaleway CLI
Interact with Scaleway API from the command line.

Quick look

Read the blog post.
Table of Contents
- Quick Start
 - Workflows
 - Commands
help [COMMAND]attach [OPTIONS] SERVERcommit [OPTIONS] SERVER [NAME]cp [OPTIONS] SERVER:PATH|HOSTPATH|- SERVER:PATH|HOSTPATH|-create [OPTIONS] IMAGEevents [OPTIONS]exec [OPTIONS] SERVER [COMMAND] [ARGS...]history [OPTIONS] IMAGEimages [OPTIONS]info [OPTIONS]inspect [OPTIONS] IDENTIFIER [IDENTIFIER...]kill [OPTIONS] SERVERlogin [OPTIONS]logout [OPTIONS]logs [OPTIONS] SERVERport [OPTIONS] SERVER [PRIVATE_PORT[/PROTO]]ps [OPTIONS]rename [OPTIONS] SERVER NEW_NAMErestart [OPTIONS] SERVER [SERVER...]rm [OPTIONS] SERVER [SERVER...]rmi [OPTIONS] IMAGE [IMAGE...]run [OPTIONS] IMAGE [COMMAND] [ARGS...]search [OPTIONS] TERMstart [OPTIONS] SERVER [SERVER...]stop [OPTIONS] SERVER [SERVER...]tag [OPTIONS] SNAPSHOT NAMEtop [OPTIONS] SERVERversion [OPTIONS]wait [OPTIONS] SERVER [SERVER...]
 - Examples
 
Overview
A command-line tool to manage Scaleway servers à-la-Docker.
For node version, check out scaleway-cli-node.
Setup
We recommend to use the latest version, using:
⚠ Ensure you have a go version >= 1.5
GO15VENDOREXPERIMENT=1 go get -u github.com/scaleway/scaleway-cli/cmd/scw
or
brew tap scaleway/scaleway
brew install scaleway/scaleway/scw --HEAD
To install a release, checkout the latest release page.
Install the latest stable release on Mac OS X using Homebrew:
brew install scw
Install the latest stable release on Mac OS X manually:
# prepare for first install and upgrade
mkdir -p /usr/local/bin
mv /usr/local/bin/scw /tmp/scw.old
# get latest release
wget "https://github.com/scaleway/scaleway-cli/releases/download/v1.11.0/scw_1.11.0_darwin_amd64.zip" -O /tmp/scw.zip
unzip /tmp/scw.zip \*/scw -d /tmp
mv /tmp/scw_*/scw /usr/local/bin
rm -rf /tmp/scw.zip /tmp/scw_*_darwin_amd64
# test
scw version
Install the latest release on Linux:
# get latest release
export ARCH=amd64  # can be 'i386', 'amd64' or 'armhf'
wget "https://github.com/scaleway/scaleway-cli/releases/download/v1.11.0/scw_1.11.0_${ARCH}.deb" -O /tmp/scw.deb
dpkg -i /tmp/scw.deb && rm -f /tmp/scw.deb
# test
scw version
Requirements
By using the static-compiled release binaries, you only needs to have one of the following platform+architecture :
| Platform | Architecture | 
|---|---|
| Darwin (Mac OS X) | i386, x86_64 | 
| FreeBSD | arm, i386, x86_64 | 
| Linux | arm, armv7, armv7, i386, x86_64 | 
| Windows | x86_64 | 
Run in Docker
You can run scaleway-cli in a sandboxed way using Docker.
⚠ caching is disabled
$ docker run -it --rm --volume=$HOME/.scwrc:/.scwrc scaleway/cli ps
Manual build
- Install go a version 
>= 1.5 - Ensure you have 
$GOPATHand$PATHwell configured, something like: 
export GOPATH=$HOME/goexport PATH=$PATH:$GOPATH/binexport GO15VENDOREXPERIMENT=1
- Install the project: 
go get github.com/scaleway/scaleway-cli/... - Run: 
scw 
Use in Golang
Scaleway-cli is written in Go, the code is splitted across multiple go-getable packages
Usage
Usage inspired by Docker CLI
$ scw
Usage: scw [OPTIONS] COMMAND [arg...]
Interact with Scaleway from the command line.
Options:
 -h, --help=false             Print usage
 -D, --debug=false            Enable debug mode
 -V, --verbose=false          Enable verbose mode
 -q, --quiet=false            Enable quiet mode
 --sensitive=false            Show sensitive data in outputs, i.e. API Token/Organization
 -v, --version=false          Print version information and quit
 --region=par1                Change the default region (e.g. ams1)
Commands:
    help      help of the scw command line
    attach    Attach to a server serial console
    commit    Create a new snapshot from a server's volume
    cp        Copy files/folders from a PATH on the server to a HOSTDIR on the host
    create    Create a new server but do not start it
    events    Get real time events from the API
    exec      Run a command on a running server
    history   Show the history of an image
    images    List images
    info      Display system-wide information
    inspect   Return low-level information on a server, image, snapshot, volume or bootscript
    kill      Kill a running server
    login     Log in to Scaleway API
    logout    Log out from the Scaleway API
    logs      Fetch the logs of a server
    port      Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
    ps        List servers
    rename    Rename a server
    restart   Restart a running server
    rm        Remove one or more servers
    rmi       Remove one or more image(s)/volume(s)/snapshot(s)
    run       Run a command in a new server
    search    Search the Scaleway Hub for images
    start     Start a stopped server
    stop      Stop a running server
    tag       Tag a snapshot into an image
    top       Lookup the running processes of a server
    version   Show the version information
    wait      Block until a server stops
Run 'scw COMMAND --help' for more information on a command.
Quick start
Login
$ scw login
Login (cloud.scaleway.com): xxxx@xx.xx
Password:
$
Run a new server my-ubuntu
$ scw run --name=my-ubuntu ubuntu-trusty bash
   [...] wait about a minute for the first boot
root@my-ubuntu:~#
Workflows
See ./examples/ directory
Commands
scw attach
Usage: scw attach [OPTIONS] SERVER
Attach to a running server serial console.
Options:
  -h, --help=false      Print usage
  --no-stdin=false      Do not attach stdin
Examples:
    $ scw attach my-running-server
    $ scw attach $(scw start my-stopped-server)
    $ scw attach $(scw start $(scw create ubuntu-vivid))
scw commit
Usage: scw commit [OPTIONS] SERVER [NAME]
Create a new snapshot from a server's volume.
Options:
  -h, --help=false      Print usage
  -v, --volume=0        Volume slot
Examples:
    $ scw commit my-stopped-server
    $ scw commit -v 1 my-stopped-server
scw cp
Usage: scw cp [OPTIONS] SERVER:PATH|HOSTPATH|- SERVER:PATH|HOSTPATH|-
Copy files/folders from a PATH on the server to a HOSTDIR on the host
running the command. Use '-' to write the data as a tar file to STDOUT.
Options:
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
  --p, --port=22        Specify SSH port
  --user=root           Specify SSH user
Examples:
    $ scw cp path/to/my/local/file myserver:path
    $ scw cp --gateway=myotherserver path/to/my/local/file myserver:path
    $ scw cp myserver:path/to/file path/to/my/local/dir
    $ scw cp myserver:path/to/file myserver2:path/to/dir
    $ scw cp myserver:path/to/file - > myserver-pathtofile-backup.tar
    $ scw cp myserver:path/to/file - | tar -tvf -
    $ scw cp path/to/my/local/dir  myserver:path
    $ scw cp myserver:path/to/dir  path/to/my/local/dir
    $ scw cp myserver:path/to/dir  myserver2:path/to/dir
    $ scw cp myserver:path/to/dir  - > myserver-pathtodir-backup.tar
    $ scw cp myserver:path/to/dir  - | tar -tvf -
    $ cat archive.tar | scw cp - myserver:/path
    $ tar -cvf - . | scw cp - myserver:path
scw create
Usage: scw create [OPTIONS] IMAGE
Create a new server but do not start it.
Options:
  --bootscript=""        Assign a bootscript
  --commercial-type=VC1S Create a server with specific commercial-type C1, VC1[S|M|L], C2[S|M|L]
  -e, --env=""           Provide metadata tags passed to initrd (i.e., boot=rescue INITRD_DEBUG=1)
  -h, --help=false       Print usage
  --ip-address=dynamic   Assign a reserved public IP, a 'dynamic' one or 'none'
  --name=""              Assign a name
  --tmp-ssh-key=false    Access your server without uploading your SSH key to your account
  -v, --volume=""        Attach additional volume (i.e., 50G)
Examples:
    $ scw create docker
    $ scw create 10GB
    $ scw create --bootscript=3.2.34 --env="boot=live rescue_image=http://j.mp/scaleway-ubuntu-trusty-tarball" 50GB
    $ scw inspect $(scw create 1GB --bootscript=rescue --volume=50GB)
    $ scw create $(scw tag my-snapshot my-image)
    $ scw create --tmp-ssh-key 10GB
scw events
Usage: scw events [OPTIONS]
Get real time events from the API.
Options:
  -h, --help=false      Print usage
scw exec
Usage: scw exec [OPTIONS] SERVER [COMMAND] [ARGS...]
Run a command on a running server.
Options:
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
  --p, --port=22        Specify SSH port
  -T, --timeout=0       Set timeout values to seconds
  --user=root           Specify SSH user
  -w, --wait=false      Wait for SSH to be ready
Examples:
    $ scw exec myserver
    $ scw exec myserver bash
    $ scw exec --gateway=myotherserver myserver bash
    $ scw exec myserver 'tmux a -t joe || tmux new -s joe || bash'
    $ SCW_SECURE_EXEC=1 scw exec myserver bash
    $ scw exec -w $(scw start $(scw create ubuntu-trusty)) bash
    $ scw exec $(scw start -w $(scw create ubuntu-trusty)) bash
    $ scw exec myserver tmux new -d sleep 10
    $ scw exec myserver ls -la | grep password
    $ cat local-file | scw exec myserver 'cat > remote/path'
scw help
Usage: scw help [COMMAND]
Help prints help information about scw and its commands.
By default, help lists available commands with a short description.
When invoked with a command name, it prints the usage and the help of
the command.
Options:
  -h, --help=false      Print usage
scw history
Usage: scw history [OPTIONS] IMAGE
Show the history of an image.
Options:
  --arch=*              Specify architecture
  -h, --help=false      Print usage
  --no-trunc=false      Don't truncate output
  -q, --quiet=false     Only show numeric IDs
scw images
Usage: scw images [OPTIONS]
List images.
Options:
  -a, --all=false       Show all images
  -f, --filter=""       Filter output based on conditions provided
  -h, --help=false      Print usage
  --no-trunc=false      Don't truncate output
  -q, --quiet=false     Only show numeric IDs
Examples:
    $ scw images
    $ scw images -a
    $ scw images -q
    $ scw images --no-trunc
    $ scw images -f organization=me
    $ scw images -f organization=official-distribs
    $ scw images -f organization=official-apps
    $ scw images -f organization=UUIDOFORGANIZATION
    $ scw images -f name=ubuntu
    $ scw images -f type=image
    $ scw images -f type=bootscript
    $ scw images -f type=snapshot
    $ scw images -f type=volume
    $ scw images -f public=true
    $ scw images -f public=false
    $ scw images -f "organization=me type=volume" -qsc
scw info
Usage: scw info [OPTIONS]
Display system-wide information.
Options:
  -h, --help=false      Print usage
scw inspect
Usage: scw inspect [OPTIONS] IDENTIFIER [IDENTIFIER...]
Return low-level information on a server, image, snapshot, volume or bootscript.
Options:
  --arch=*              Specify architecture
  -b, --browser=false   Inspect object in browser
  -f, --format=""       Format the output using the given go template
  -h, --help=false      Print usage
Examples:
    $ scw inspect my-server
    $ scw inspect server:my-server
    $ scw inspect --browser my-server
    $ scw inspect a-public-image
    $ scw inspect image:a-public-image
    $ scw inspect my-snapshot
    $ scw inspect snapshot:my-snapshot
    $ scw inspect my-volume
    $ scw inspect volume:my-volume
    $ scw inspect my-image
    $ scw inspect image:my-image
    $ scw inspect my-server | jq '.[0].public_ip.address'
    $ scw inspect $(scw inspect my-image | jq '.[0].root_volume.id')
    $ scw inspect -f "{{ .PublicAddress.IP }}" my-server
    $ scw --sensitive inspect my-server
scw kill
Usage: scw kill [OPTIONS] SERVER
Kill a running server.
Options:
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
scw login
Usage: scw login [OPTIONS]
Generates a configuration file in '/home/$USER/.scwrc'
containing credentials used to interact with the Scaleway API. This
configuration file is automatically used by the 'scw' commands.
You can get your credentials on https://cloud.scaleway.com/#/credentials
Options:
  -h, --help=false      Print usage
  -o, --organization="" Organization
  -s, --skip-ssh-key=false Don't ask to upload an SSH Key
  -t, --token=""        Token
scw logout
Usage: scw logout [OPTIONS]
Log out from the Scaleway API.
Options:
  -h, --help=false      Print usage
scw logs
Usage: scw logs [OPTIONS] SERVER
Fetch the logs of a server.
Options:
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
  --p, --port=22        Specify SSH port
  --user=root           Specify SSH user
scw port
Usage: scw port [OPTIONS] SERVER [PRIVATE_PORT[/PROTO]]
List port mappings for the SERVER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
Options:
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
  --p, --port=22        Specify SSH port
  --user=root           Specify SSH user
scw ps
Usage: scw ps [OPTIONS]
List servers. By default, only running servers are displayed.
Options:
  -a, --all=false       Show all servers. Only running servers are shown by default
  -f, --filter=""       Filter output based on conditions provided
  -h, --help=false      Print usage
  -l, --latest=false    Show only the latest created server, include non-running ones
  -n=0                  Show n last created servers, include non-running ones
  --no-trunc=false      Don't truncate output
  -q, --quiet=false     Only display numeric IDs
Examples:
    $ scw ps
    $ scw ps -a
    $ scw ps -l
    $ scw ps -n=10
    $ scw ps -q
    $ scw ps --no-trunc
    $ scw ps -f state=booted
    $ scw ps -f state=running
    $ scw ps -f state=stopped
    $ scw ps -f ip=212.47.229.26
    $ scw ps -f tags=prod
    $ scw ps -f tags=boot=live
    $ scw ps -f image=docker
    $ scw ps -f image=alpine
    $ scw ps -f image=UUIDOFIMAGE
    $ scw ps -f arch=ARCH
    $ scw ps -f server-type=COMMERCIALTYPE
    $ scw ps -f "state=booted image=docker tags=prod"
scw rename
Usage: scw rename [OPTIONS] SERVER NEW_NAME
Rename a server.
Options:
  -h, --help=false      Print usage
scw restart
Usage: scw restart [OPTIONS] SERVER [SERVER...]
Restart a running server.
Options:
  -h, --help=false      Print usage
  -T, --timeout=0       Set timeout values to seconds
  -w, --wait=false      Synchronous restart. Wait for SSH to be ready
scw rm
Usage: scw rm [OPTIONS] SERVER [SERVER...]
Remove one or more servers.
Options:
  -f, --force=false     Force the removal of a server
  -h, --help=false      Print usage
Examples:
    $ scw rm myserver
    $ scw rm -f myserver
    $ scw rm my-stopped-server my-second-stopped-server
    $ scw rm $(scw ps -q)
    $ scw rm $(scw ps | grep mysql | awk '{print $1}')
scw rmi
Usage: scw rmi [OPTIONS] IDENTIFIER [IDENTIFIER...]
Remove one or more image(s)/volume(s)/snapshot(s)
Options:
  -h, --help=false      Print usage
Examples:
    $ scw rmi myimage
    $ scw rmi mysnapshot
    $ scw rmi myvolume
    $ scw rmi $(scw images -q)
scw run
Usage: scw run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new server.
Options:
  -a, --attach=false    Attach to serial console
  --bootscript=""       Assign a bootscript
  --commercial-type=VC1S Start a server with specific commercial-type C1, VC1[S|M|L], C2[S|M|L]
  -d, --detach=false    Run server in background and print server ID
  -e, --env=""          Provide metadata tags passed to initrd (i.e., boot=rescue INITRD_DEBUG=1)
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
  --ip-address=""       Assign a reserved public IP, a 'dynamic' one or 'none' (default to 'none' if gateway specified, 'dynamic' otherwise)
  --ipv6=false          Enable IPV6
  --name=""             Assign a name
  --p, --port=22        Specify SSH port
  --rm=false            Automatically remove the server when it exits
  --show-boot=false     Allows to show the boot
  -T, --timeout=0       Set timeout value to seconds
  --tmp-ssh-key=false   Access your server without uploading your SSH key to your account
  -u, --userdata=""     Start a server with userdata predefined
  --user=root           Specify SSH User
  -v, --volume=""       Attach additional volume (i.e., 50G)
Examples:
    $ scw run ubuntu-trusty
    $ scw run --commercial-type=C2S ubuntu-trusty
    $ scw run --show-boot --commercial-type=C2S ubuntu-trusty
    $ scw run --rm ubuntu-trusty
    $ scw run -a --rm ubuntu-trusty
    $ scw run --gateway=myotherserver ubuntu-trusty
    $ scw run ubuntu-trusty bash
    $ scw run --name=mydocker docker docker run moul/nyancat:armhf
    $ scw run --bootscript=3.2.34 --env="boot=live rescue_image=http://j.mp/scaleway-ubuntu-trusty-tarball" 50GB bash
    $ scw run --attach alpine
    $ scw run --detach alpine
    $ scw run --tmp-ssh-key alpine
    $ scw run --userdata="FOO=BAR FILE=@/tmp/file" alpine
┌ ─ ─ ─ ─ ─ scw run docker  ─ ─ ─ ─ ┐
│   ┌───────────────────────────┐   │
    │server=$(scw create docker)│
│   └───────────────────────────┘   │
                  +
│        ┌─────────────────┐        │
         │scw start $SERVER│
│        └─────────────────┘        │
                  +
│┌─────────────────────────────────┐│
 │scw exec --wait $SERVER /bin/bash│
│└─────────────────────────────────┘│
 ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
scw search
Usage: scw search [OPTIONS] TERM
Search the Scaleway Hub for images.
Options:
  -h, --help=false      Print usage
  --no-trunc=false      Don't truncate output
scw start
Usage: scw start [OPTIONS] SERVER [SERVER...]
Start a stopped server.
Options:
  -h, --help=false      Print usage
  -T, --timeout=0       Set timeout values to seconds
  -w, --wait=false      Synchronous start. Wait for SSH to be ready
scw stop
➜  scaleway-cli git:(master) ✗ clear; scw help stop
Usage: scw stop [OPTIONS] SERVER [SERVER...]
Stop a running server.
Options:
  -h, --help=false      Print usage
  -t, --terminate=false Stop and trash a server with its volumes
  -w, --wait=false      Synchronous stop. Wait for SSH to be ready
Examples:
    $ scw stop my-running-server my-second-running-server
    $ scw stop -t my-running-server my-second-running-server
    $ scw stop $(scw ps -q)
    $ scw stop $(scw ps | grep mysql | awk '{print $1}')
    $ scw stop server && stop wait server
    $ scw stop -w server
scw tag
Usage: scw tag [OPTIONS] SNAPSHOT NAME
Tag a snapshot into an image.
Options:
  -h, --help=false      Print usage
  --bootscript=""       Assign a bootscript
scw top
Usage: scw top [OPTIONS] SERVER
Lookup the running processes of a server.
Options:
  -g, --gateway=""      Use a SSH gateway
  -h, --help=false      Print usage
  --p, --port=22        Specify SSH port
  --user=root           Specify SSH user
scw version
Usage: scw version [OPTIONS]
Show the version information.
Options:
  -h, --help=false      Print usage
scw wait
➜  scaleway-cli git:(master) ✗ clear; scw help wait
Usage: scw wait [OPTIONS] SERVER [SERVER...]
Block until a server stops.
Options:
  -h, --help=false      Print usage
Examples
Create a server with Ubuntu Trusty image and 3.2.34 bootscript
$ scw create --bootscript=3.2.34 trusty
df271f73-60ce-47fd-bd7b-37b5f698d8b2
Create a server with Fedora 21 image
$ scw create 1f164079
7313af22-62bf-4df1-9dc2-c4ffb4cb2d83
Create a server with an empty disc of 20G and rescue bootscript
$ scw create --bootscript=rescue 20G
5cf8058e-a0df-4fc3-a772-8d44e6daf582
Run a stopped server
$ scw start 7313af22
7313af22-62bf-4df1-9dc2-c4ffb4cb2d83
Run a stopped server and wait for SSH to be ready
$ scw start --wait myserver
myserver
$ scw exec myserver /bin/bash
[root@noname ~]#
Run a stopped server and wait for SSH to be ready (inline version)
$ scw exec $(scw start --wait myserver) /bin/bash
[root@noname ~]#
Create, start and ssh to a new server (inline version)
$ scw exec $(scw start --wait $(scw create ubuntu-trusty)) /bin/bash
[root@noname ~]#
or
$ scw exec --wait $(scw start $(scw create ubuntu-trusty)) /bin/bash
[root@noname ~]#
Wait for a server to be available, then execute a command
$ scw exec --wait myserver /bin/bash
[root@noname ~]#
Run a command in background
$ scw exec alpine tmux new -d "sleep 10"
Run a stopped server and wait for SSH to be ready with a global timeout of 150 seconds
$ scw start --wait --timeout=150 myserver
global execution... failed: Operation timed out.
Wait for a server to be in 'stopped' state
$ scw wait 7313af22
[...] some seconds later
0
Attach to server serial port
$ scw attach 7313af22
[RET]
Ubuntu Vivid Vervet (development branch) nfs-server ttyS0
my-server login:
^C
$
Create a server with Fedora 21 image and start it
$ scw start `scw create 1f164079`
5cf8058e-a0df-4fc3-a772-8d44e6daf582
Execute a 'ls -la' on a server (via SSH)
$ scw exec myserver ls -la
total 40
drwx------.  4 root root 4096 Mar 26 05:56 .
drwxr-xr-x. 18 root root 4096 Mar 26 05:56 ..
-rw-r--r--.  1 root root   18 Jun  8  2014 .bash_logout
-rw-r--r--.  1 root root  176 Jun  8  2014 .bash_profile
-rw-r--r--.  1 root root  176 Jun  8  2014 .bashrc
-rw-r--r--.  1 root root  100 Jun  8  2014 .cshrc
drwxr-----.  3 root root 4096 Mar 16 06:31 .pki
-rw-rw-r--.  1 root root 1240 Mar 12 08:16 .s3cfg.sample
drwx------.  2 root root 4096 Mar 26 05:56 .ssh
-rw-r--r--.  1 root root  129 Jun  8  2014 .tcshrc
Run a shell on a server (via SSH)
$ scw exec 5cf8058e /bin/bash
[root@noname ~]#
List public images and my images
$ scw images
REPOSITORY                                 TAG      IMAGE ID   CREATED        VIRTUAL SIZE
user/Alpine_Linux_3_1                      latest   854eef72   10 days ago    50 GB
Debian_Wheezy_7_8                          latest   cd66fa55   2 months ago   20 GB
Ubuntu_Utopic_14_10                        latest   1a702a4e   4 months ago   20 GB
...
List public images, my images and my snapshots
$ scw images -a
REPOSITORY                                 TAG      IMAGE ID   CREATED        VIRTUAL SIZE
noname-snapshot                            <none>   54df92d1   a minute ago   50 GB
cool-snapshot                              <none>   0dbbc64c   11 hours ago   20 GB
user/Alpine_Linux_3_1                      latest   854eef72   10 days ago    50 GB
Debian_Wheezy_7_8                          latest   cd66fa55   2 months ago   20 GB
Ubuntu_Utopic_14_10                        latest   1a702a4e   4 months ago   20 GB
List running servers
$ scw ps
SERVER ID   IMAGE                       COMMAND   CREATED          STATUS    PORTS   NAME
7313af22    user/Alpine_Linux_3_1                 13 minutes ago   running           noname
32070fa4    Ubuntu_Utopic_14_10                   36 minutes ago   running           labs-8fe556
List all servers
$ scw ps -a
SERVER ID   IMAGE                       COMMAND   CREATED          STATUS    PORTS   NAME
7313af22    user/Alpine_Linux_3_1                 13 minutes ago   running           noname
32070fa4    Ubuntu_Utopic_14_10                   36 minutes ago   running           labs-8fe556
7fc76a15    Ubuntu_Utopic_14_10                   11 hours ago     stopped           backup
Stop a running server
$ scw stop 5cf8058e
5cf8058e
Stop multiple running servers
$ scw stop myserver myotherserver
901d082d-9155-4046-a49d-94355344246b
a0320ec6-141f-4e99-bf33-9e1a9de34171
Terminate a running server
$ scw stop -t myserver
901d082d-9155-4046-a49d-94355344246b
Stop all running servers matching 'mysql'
$ scw stop $(scw ps | grep mysql | awk '{print $1}')
901d082d-9155-4046-a49d-94355344246b
a0320ec6-141f-4e99-bf33-9e1a9de34171
36756e6e-3146-4b89-8248-abb060fc5b61
Create a snapshot of the root volume of a server
$ scw commit 5cf8058e
54df92d1
Delete a stopped server
$ scw rm 5cf8
5cf8082d-9155-4046-a49d-94355344246b
Delete multiple stopped servers
$ scw rm myserver myotherserver
901d082d-9155-4046-a49d-94355344246b
a0320ec6-141f-4e99-bf33-9e1a9de34171
Delete all stopped servers matching 'mysql'
$ scw rm $(scw ps -a | grep mysql | awk '{print $1}')
901d082d-9155-4046-a49d-94355344246b
a0320ec6-141f-4e99-bf33-9e1a9de34171
36756e6e-3146-4b89-8248-abb060fc5b61
Create a snapshot of nbd1
$ scw commit 5cf8058e -v 1
f1851f99
Create an image based on a snapshot
$ scw tag 87f4526b my_image
46689419
Delete an image
$ scw rmi 46689419
Send a 'halt' command via SSH
$ scw kill 5cf8058e
5cf8058e
Inspect a server
$ scw inspect 90074de6
[
  {
    "server": {
    "dynamic_ip_required": true,
    "name": "My server",
    "modification_date": "2015-03-26T09:01:07.691774+00:00",
    "tags": [
      "web",
      "production"
    ],
    "state_detail": "booted",
    "public_ip": {
      "dynamic": true,
      "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "address": "212.47.xxx.yyy"
    },
    "state": "running",
  }
]
Show public ip address of a server
$ scw inspect myserver | jq '.[0].public_ip.address'
212.47.xxx.yyy
Changelog
v1.11.1 (2016-11-17)
- API: try to connect trough the gateway when nc doesn't work
 - API: hotfix region with user images
 - API: fix filter on paginate page
 
View full commits list
v1.11 (2016-10-27)
- new Compute URL 
api.scaleway.com->cp-par1.scaleway.com - new TTY URL 
tty.scaleway.com/v2->tty-par1.scaleway.com/v2 - Region: add 
ams1, you can start a server at Amsterdam withscw --region="ams1" run yakkety - API: Support multi-zone
 - API: Add ZoneID field in server location
 scw image -a -f type=volumefix unmarshal error on size fieldscw psdo not display empty server with --filter
View full commits list
v1.10.1 (2016-10-24)
scw loginfix CheckCredentials (418)
View full commits list
v1.10 (2016-10-24)
- API rename 
deleteServerSafe->deleteServerForce - API support paginate
 - API more verbose with 
-V - Better handling of secondary volumes size (361)
 - Add a global flag, 
--regionto change the defaut region scw exec --gatewayremove hardcoded 30 seconds sleep (#254)ScalewayServeradd DNS fields (#157)scw [logs|exec|cp|port|run|top]add--user&&--port(#396)scw pssort the servers by CreationDate (#391)- Fix regression on bootscript (#387)
 scw [run|start]Add--set-stateflagscw loginAdd motd when you are already logged (#371)scw _ipsadd --detach flag- API add DetachIP method (@nicolai86)
 - Cache remove log dependency
 - Fix error message with 
--commercial-type=c2m(#374) - Add Logger Interface to avoid multiples dependencies in the API, thank you @nicolai86 (#369)
 scw runhandle--ipv6flagscw createhandle--ipv6flag- Fix panic when the commercial-type is lower than 2 characters (#365)
 - gotty-client enable ProxyFromEnviromnent (#363) (@debovema)
 scw inspectfix panic (#353)- Clear cache between the releases (#329)
 - Fix 
scw _patch bootscriptnil dereference - Fix 
scw imagesbad error message (#336) - Fix sshExecCommand with Windows (#338)
 - Fix 
scw loginwith Windows (#341) - Add 
enable_ipv6field (#334) scw _patchhandles ipv6=[true|false]- Add 
ScalewayIPV6Definition - Add marketplace alias in the cache to resolve image (#330)
 scw _userdatahandles@~/path/to/file(#321)- Update 
scw _billingfor new instance types (#293) 
View full commits list
v1.9.0 (2016-04-01)
- Fix bug when using SCW_COMMERCIAL_TYPE variable
 - Switch to VC1S
 
View full commits list
v1.8.1 (2016-03-29)
- Fix 
ScalewayBootscriptstructure scw _userdatafix bug when we have multiple '=' in the value (#320)- GetBootscriptID doesn't try to resolve when we pass an UUID
 - Add location fields for VPS
 scw psadd commercial-type column- Use 
SCW_SECURE_EXECinstead ofexec_exec - Remove 
scaleway_api_endpointenvironment variable - brew remove cache after install
 scw logindon't ask to upload ssh key when there is no keys
View full commits list
v1.8.0 (2016-03-17)
- Use VC1 by default
 scw execAdd warning to try to clean the cache when an error occurred- Add 
SCW_[COMPUTE|ACCOUNT|METADATA|MARKETPLACE]_APIenvironment variable - Remove --api-endpoint
 - Fix uploading SSH key with 
scw login - Use markerplace API in GetImages()
 - Add 
_markerplace scw renamefix nil dereference (#289)- Support of 
scw [run|create] --ip-address=[none|dynamic](#283) (@ElNounch) - Support of 
scw ps -f server-type=COMMERCIALTYPE(#280) - Support of 
scw ps -f arch=XXX(#278) scw infoUse json fingerprint field exposed by API- Allow to override Region and Architecture when using the helpers to create a new volume from a human size
 - Do not check permissions on config file under Windows (#282) (@ElNounch)
 - Update pricing (#294)
 - create-image-from-http.sh: using VPS instead of C1 (#301)
 
View full commits list
v1.7.1 (2016-01-29)
View full commits list
v1.7.0 (2016-01-27)
- SCALEWAY_VERBOSE_API is now SCW_VERBOSE_API
 - SCALEWAY_TLSVERIFY is now SCW_TLSVERIFY
 - Add a warn message when using 
ssh execon host without public ip nor gateway (#171) - Display 
ssh-host-fingerprintswhen it's available (#194) - Support of 
scw rmisnapshot|volume (#258) - Match bootscript/image with the good architecture (#255)
 - Support of region/owner/arch in the cache file (#255)
 - Remove some 
fatalandExit - Use rfc4716 (openSSH) to generate the fingerprints (#151)
 - Switch from 
PartytoGodep - create-image-from-http.sh: Support HTTP proxy (#249)
 - Support of 
scw run --userdata=...(#202) - Refactor of 
scw _security-groups(#197) - Support of 
scw tag --arch=XXX - Support of 
scw run --timeout=X(#239) - Check the "stopped" state for 
scw run | exec -w(#229) - Basic support of Server.CommercialType
 - Support of 
SCW_GOTTY_URLenvironment variable 
View full commits list
v1.6.0 (2015-11-18)
- Support of 
scw create|run --ip-address(#235) - Update gotty-client to 1.3.0
 - Support of 
scw run --show-bootoption (#156) - Remove go1.[34] support
 - Improve _cs format (#223)
 - Use 
gotty-clientinstead oftermjs-cli - Fix: bad detection of server already started when starting a server (#224) - @arianvp
 - Added _cs (#180)
 - Report quotas in 
scw info(#130) - Added 
SCALEWAY_VERBOSE_APIto make the API more verbose - Support of 
scw _ipscommand ... (#196) - Report permissions in 
scw info(#191) - Report dashboard statistics in 
scw info(#177) - Support of 
scw _userdata name VAR=@/path/to/file(#183) - Support of 
scw restart -w(#185) - Restarting multiple servers in parallel (#185)
 - Added _security-groups (#179)
 - Reflect server location in 
scw inspect(#204) 
View full commits list
v1.5.0 (2015-09-11)
- Support of 
scw tag --bootscript=""option (#149) scw infonow prints user/organization info from the API (#130)- Added helpers to manipulate new 
user_dataAPI (#150) - Renamed 
create-image-from-s3.shexample and now auto-filling image metadata (title and bootscript) based on the Makefile configuration - Support of 
scw rm -f/--forceoption (#158) - Added 
scw _userdata local ...option which interacts with the Metadata API without authentication (#166) - Initial version of 
scw _billing(price estimation tool) (#118) - Fix: debian-package installation
 - Fix: nil pointer dereference (#155) (@ebfe)
 - Fix: regression on scw create (#142)
 - Stability improvements
 
View full commits list
v1.4.0 (2015-08-28)
Features
-D,--debugmode shows ready to copy-pastecurlcommands when using the API (must be used with--sensitiveto unhide private token)- Support of 
_patch SERVER tags="tag1 tag2=value2 tag3" scw -D logindisplays a fake password- Support --skip-ssh-key 
scw login(#129) - Now 
scw loginask your login/password, you can also pass token and organization with -o and -t (#59) - Support of 
scw images --filteroption (type, organization, name, public) (#134) - Support of 
scw {ps,images} --filteroption (images: type,organization,name,public; ps:state,ip,tags,image) (#134) - Syncing cache to disk after server creation when running 
scw runin a non-detached mode - Bump to Golang 1.5
 - Support --tmp-ssh-key 
scw {run,create}option (#99) - Support of 
scw run --rmoption (#117) - Support of 
--gateway=login@host(#110) - Upload local ssh key to scaleway account on 
scw login(#100) - Add a 'running indicator' for 
scw run, can be disabled with the new flag--quiet - Support of 
scw -V/--verboseoption (#83) - Support of 
scw inspect --browseroption - Support of 
scw _flush-cacheinternal command scw run --gateway ...orSCW_GATEWAY="..." scw run ...now creates a server without public ip address (#74)scw inspect TYPE:xxx TYPE:yyywill only refresh cache forTYPE- Sorting cache search by Levenshtein distance (#87)
 - Allow set up api endpoint using the environment variable $scaleway_api_endpoint
 - Use TLS and verify can now be disabled using 
SCALEWAY_TLSVERIFY=0env var (#115) - Switched to 
goxcfor releases 
Fixes
- Moved ssh command generation code to dedicated package
 - Global refactor to improve Golang library usage, allow chaining of commands and ease the writing of unit tests (#80)
 scw search TERMwas not restricting results based onTERM- Bumped dependencies
 - Hiding more sensitive data (#77)
 - Fixed "Run in Docker" usage (#90)
 - Improved 
-D/--debugoutputs 
View full commits list
1.3.0 (2015-07-20)
Features
Fixes
- Issue with 
scw top's usage - Minor code improvements
 
View full commits list
1.2.1 (2015-07-01)
Features
- Support of 
scw run -doption (#69) 
Fixes
- Version vendor source code (Godeps)
 
View full commits list
1.2.0 (2015-06-29)
Features
- Support of 
_patch SERVER security_groupand_patch SERVER bootscript - Improved resolver behavior when matching multiple results, now displaying more info too help choosing candidates (#47)
 scw exec SERVER [COMMAND] [ARGS...], COMMAND is now optional- Showing the server MOTD when calling 
scw run <image> [COMMAND]without COMMAND - Support of 
scw attach --no-stdinoption - Hiding sensitive data by default on 
scw inspect(#64) - Support of 
scw --sensitiveoption (#64) - Support of 
scw run --attachoption (#65) scw {create,run}, prefixing root-volume with the server hostname (#63)scw {create,run} IMAGE, IMAGE can be a snapshot (#19)- Support of 
scw stop -w, --waitoption - Identifiers can be prefixed with the type of the resource, i.e: 
scw inspect my-server==scw inspect server:my-serverIt may be useful if you have the same name in a server and a volume - Improved support of zsh completion
 
Fixes
scw inspect -fwas always exiting 0scw images -adoes not prefix snapshots, volumes and bootscripts (only images)scw run ...waits for 30 seconds before polling the APIscw stop server1 server2doesn't exit on first stopping failurescw run IMAGE [COMMAND], default COMMAND is nowif [ -x /bin/bash ]; then exec /bin/bash; else exec /bin/sh; fiscw run|create SNAPSHOT, raised an error if snapshot does not have base volumescw stop -tremoves server entry from cache
View full commits list
1.1.0 (2015-06-12)
Features
- Support of 
scw cpfrom {server-path,local-path,stdin} to {server-path,local-path,stdout} (#56) - Support of 
scw logoutcommand - Support of 
_patchexperimental command (#57) - Support of 
_completioncommand (shell completion helper) (#45) - Returning more resource fields on 
scw inspect(#50) - Show public ip address in PORTS field in 
scw ps(#54) - Support of 
inspect --formatoption - Support of 
exec --timeoutoption (#31) - Support of volumes in 
images -aandinspect(#49) - Tuned 
~/.scwrcunix permissions + added a warning if the file is too open (#48) 
Fixes
- The project is now 
go get-able and splitted into packages - Added timeout when polling SSH TCP port for 
scw start -wandscw exec -w(#46) - Improved resolver behavior for exact matching (#53, #55)
 - Verbose error message when 
scw execfails (#42) - Fixed 
scw loginparameters parsing - Speed and stability improvements
 
View full commits list
1.0.0 (2015-06-05)
First Golang version. For previous Node.js versions, see scaleway-cli-node.
Features
- Support of 
attachcommand - Support of 
commitcommand- Support of 
commit -v, --volumeoption 
 - Support of 
 - Support of 
cpcommand - Support of 
createcommand- Support of 
create --bootscriptoption - Support of 
create -e, --envoption - Support of 
create --nameoption - Support of 
create -v, --volumeoption 
 - Support of 
 - Support of 
eventscommand - Support of 
execcommand- Support of 
exec -w, --waitoption 
 - Support of 
 - Support of 
helpcommand - Support of 
historycommand- Support of 
history --no-truncoption - Support of 
history -q, --quietoption 
 - Support of 
 - Support of 
imagescommand- Support of 
images -a, --alloption - Support of 
images --no-truncoption - Support of 
images -q, --quietoption 
 - Support of 
 - Support of 
infocommand - Support of 
inspectcommand - Support of 
killcommand - Support of 
logincommand - Support of 
logscommand - Support of 
portcommand - Support of 
pscommand- Support of 
ps -a, --alloption - Support of 
ps -noption - Support of 
ps -l, --latestoption - Support of 
ps --no-truncoption - Support of 
ps -q, --quietoption 
 - Support of 
 - Support of 
renamecommand - Support of 
restartcommand - Support of 
rmcommand - Support of 
rmicommand - Support of 
runcommand- Support of 
run --bootscriptoption - Support of 
run -e, --envoption - Support of 
run --nameoption - Support of 
run -v, --volumeoption 
 - Support of 
 - Support of 
searchcommand- Support of 
search --no-truncoption 
 - Support of 
 - Support of 
startcommand- Support of 
start -w, --waitoption - Support of 
start -T, --timeoutoption 
 - Support of 
 - Support of 
stopcommand- Support of 
stop -t, --terminateoption 
 - Support of 
 - Support of 
tagcommand - Support of 
topcommand - Support of 
versioncommand - Support of 
waitcommand 
gopkg.in/scaleway/scaleway-cli.v1
POC (2015-03-20)
First Node.js version
Development
Feel free to contribute 😃🍻
Hack
- Install go
 - Ensure you have 
$GOPATHand$PATHwell configured, something like: 
export GOPATH=$HOME/goexport PATH=$PATH:$GOPATH/bin
- Fetch the project: 
go get -d github.com/scaleway/scaleway-cli/... - Go to scaleway-cli directory: 
cd $GOPATH/src/github.com/scaleway/scaleway-cli - Hack: 
emacs - Build: 
make - Run: 
./scw 
License
      
      Documentation
      ¶
    
    
  
    
  
    There is no documentation for this package.
      
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| 
       cmd
        | 
      |
| 
         
          
            scw
            
            command
          
          
         
       | 
      |
| 
       pkg
        | 
      |
| 
         
          
            api
            
            
          
           
      Package api contains client and functions to interact with Scaleway API 
         | 
      Package api contains client and functions to interact with Scaleway API | 
| 
         
          
            cli
            
            
          
           
      Package cli contains CLI commands 
         | 
      Package cli contains CLI commands | 
| 
         
          
            commands
            
            
          
           
      Package commands contains the workflows behind each commands of the CLI (run, attach, start, exec, commit, ...) 
         | 
      Package commands contains the workflows behind each commands of the CLI (run, attach, start, exec, commit, ...) | 
| 
         
          
            config
            
            
          
           
      Package config contains helpers to manage '~/.scwrc' 
         | 
      Package config contains helpers to manage '~/.scwrc' | 
| 
         
          
            utils
            
            
          
           
      Package utils contains logquiet 
         | 
      Package utils contains logquiet |