Skip to content

clockbone/ucloud-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ucloud-cli

The ucloud-cli provides a unified command line interface to manage Ucloud services. It works through Golang SDK based on UCloud OpenAPI and support Linux, macOS, and Windows.

Installation

The easiest way to install ucloud-cli is to use home-brew for Linux and macOS users. This will install the package as well as all dependencies.

$ brew install ucloud

If you have the ucloud-cli installed and want to upgrade to the latest version you can run:

$ brew upgrade ucloud

Note

If you come across error during the installation via home-brew, you may update the management package first.

$ brew update

Build from the source code

For windows users, suggest build from the source code which require install Golang first. This also works for Linux and macOS.

$ mkdir -p $GOPATH/src/github.com/ucloud
$ cd $GOPATH/src/github.com/ucloud
$ git clone https://github.com/ucloud/ucloud-cli.git
$ cd ucloud-cli
$ make install

Command Completion

The ucloud-cli include command completion feature and need configure it manually. Add following scripts to ~/.bash_profile or ~/.bashrc

complete -C /usr/local/bin/ucloud ucloud

Zsh shell please add following scripts to ~/.zshrc

autoload -U +X bashcompinit && bashcompinit
complete -F /usr/local/bin/ucloud ucloud

Getting Started

Run the command to get started and configure ucloud-cli follow the steps. The public & private keys will be saved automatically and locally to directory ~/.ucloud. You can delete the directory whenever you want.

$ ucloud init

To reset the configurations, run the command:

$ ucloud config

To learn the usage and flags, run the command:

$ ucloud help

Example

Taking create uhost in Nigeria (region: air-nigeria) and bind a public IP as an example, then configure GlobalSSH to accelerate the SSH efficiency beyond China mainland.

First to create an uhost instance:

$ ucloud uhost create --cpu 1 --memory 1 --password mypassword123 --image-id uimage-fya3qr

UHost:[uhost-tr1eau] created successfully!

Note

Run follow command to get details regarding the parameters to create new uhost instance.

$ ucloud uhost create --help

And suggest run the command to get the image-id first.

$ ucloud image list

Secondly, we're going to allocate an EIP and bind to the instance created above.

$ ucloud eip allocate --line International --bandwidth 1
EIPId:eip-xov13b,IP:152.32.140.92,Line:International 

$ ucloud eip bind --eip-id eip-xov13b --resource-id uhost-tr1eau
EIP: [eip-xov13b] bind with uhost:[uhost-tr1eau] successfully 

Configure the GlobalSSH to the uhost instance and login the instance via GlobalSSH

$ ucloud gssh create --location Washington --target-ip 152.32.140.92
ResourceID: uga-pdhxvs

$ ssh [email protected]
[email protected]'s password: password of the uhost instance

About

UCloud Command Line Interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.3%
  • Makefile 0.7%