GithubHelp home page GithubHelp logo

aliyun / aliyun-cli Goto Github PK

View Code? Open in Web Editor NEW
817.0 51.0 200.0 17.87 MB

Alibaba Cloud CLI

License: Apache License 2.0

Shell 0.70% Makefile 0.15% Go 99.02% PowerShell 0.13%
alibaba alibabacloud alibaba-cloud-cli cloud-api cli alibaba-cloud-openapi rpc-api sdk client a-li-yun

aliyun-cli's Introduction

English | 简体中文

Alibaba Cloud CLI

Go build Status codecov License Go Report
Latest Stable Version GitHub Release Date
GitHub All Releases

The Alibaba Cloud CLI is an open source tool, you can get the latest version from GitHub. You can also try it out in the Cloud Shell before installing the CLI.

Introduction

The Alibaba Cloud CLI is a tool to manage and use Alibaba Cloud resources through a command line interface. It is written in Go and built on the top of Alibaba Cloud OpenAPI.

Note: Alibaba Cloud CLI access the Alibaba Cloud services through OpenAPI. Before using Alibaba Cloud CLI, make sure that you have activated the service to use and known how to use OpenAPI.

Troubleshoot

Troubleshoot Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through RequestID or error message.

CLI Releases

The release notes for the CLI can be found in the CHANGELOG

Installation

  • Download installer (Recommended)

    Download the installer, then extract the installer. You can move the extracted aliyun executable file to the /usr/local/bin directory or add it to the $PATH.

    Download link: (Latest Stable Version)

    All releases please click here.

  • Use brew If you have installed brew in your computer, you can use it to install Alibaba Cloud CLI as following:

brew install aliyun-cli
  • Use one-liner script

You can paste the following command in a macOS Terminal or Linux shell prompt.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/aliyun/aliyun-cli/HEAD/install.sh)"

If you need detailed installation steps or compile the installation steps, please visit Installation Guide.

Configure

For detailed configuration instructions, please visit the official website Configuration Alibaba Cloud CLI.

Before using Alibaba Cloud CLI to invoke the services, you need to configure the credential information, region, language, etc.

You can run the aliyun configure command for quick configuration.

$ aliyun configure
Configuring profile 'default' ...
Aliyun Access Key ID [None]: <Your AccessKey ID>
Aliyun Access Key Secret [None]: <Your AccessKey Secret>
Default Region Id [None]: cn-hangzhou
Default output format [json]: json
Default Language [zh]: zh

Configure authentication methods

You can specify the authentication method to use by using the configure command with the --mode <authenticationMethod> option.

The following are supported authentication methods:

Authentication methods Description
AK Use AccessKey ID and Secret to access Alibaba Cloud services
StsToken Use STS token to access Alibaba Cloud services
RamRoleArn Use the AssumeRole to access Alibaba Cloud services
EcsRamRole Use the EcsRamRole to access ECS resources

Use an external program to get credentials

You can use --mode External to specify to obtain credential data through an external program, and CLI will execute the program command and return it as a credential to initiate the call.

Agreement:

  1. The output location of the external program is standard output.
  2. The output format is json string.
  3. The output contains the key fields required by the CLI and credential fields

Key field:

  • mode: Specify the type of credentials returned

Example of the return of each credential type:

  • AK
{
  "mode": "AK",
  "access_key_id": "accessKeyId",
  "access_key_secret": "accessKeySecret"
}
  • StsToken
{
  "mode": "StsToken",
  "access_key_id": "accessKeyId",
  "access_key_secret": "accessKeySecret",
  "sts_token": "stsToken"
}
  • RamRoleArn
{
  "mode": "RamRoleArn",
  "access_key_id": "accessKeyId",
  "access_key_secret": "accessKeySecret",
  "ram_role_arn": "ramRoleArn",
  "ram_session_name": "ramSessionName"
}
  • EcsRamRole
{
  "mode": "EcsRamRole",
  "ram_role_name": "ramRoleName"
}

Example

$ aliyun configure --mode External --profile externalTest
Configuring profile 'externalTest' in 'External' authenticate mode...
Process Command []: <getCredential ak>
Default Region Id []: cn-hangzhou
Default Output Format [json]: json (Only support json)
Default Language [zh|en] en: 
Saving profile[externalTest] ...Done.

Use chainable RamRoleArn

You can use --mode ChainableRamRoleArn to combile a source profile and RAM role ARN flow. The following example get intermediate credentials from source profile cli-test, then use it to call AssumeRole for get final credentials.

{
  "profiles": [
    {
      "name": "chain",
      "mode": "ChainableRamRoleArn",
      "ram_role_arn": "acs:ram::<Account ID>:role/<Role Name>",
      "ram_session_name": "session",
      "source_profile": "cli-test"
    },
    {
      "name": "cli-test",
      "mode": "AK",
      "access_key_id": "<Access Key ID>",
      "access_key_secret": "<Access Key Secret>"
    }
  ]
}

Use Credentials URI

You can use --mode CredentialsURI to get credentials from local/remote URI.

{
  "profiles": [
    {
      "name": "uri",
      "mode": "CredentialsURI",
      "credentials_uri": "http://localhost:6666/?user=jacksontian"
    }
  ]
}

The Credentials URI must be response with status code 200, and following body:

{
  "Code": "Success",
  "AccessKeyId": "<ak id>",
  "AccessKeySecret": "<ak secret>",
  "SecurityToken": "<security token>",
  "Expiration": "2006-01-02T15:04:05Z" // utc time
}

Otherwise, CLI treate as failure case.

Enable bash/zsh auto completion

  • Use aliyun auto-completion command to enable auto completion in zsh/bash
  • Use aliyun auto-completion --uninstall command to disable auto completion.

Use Alibaba Cloud CLI

Here is the basic usage guidelines. If you need a detailed manual, please visit Use Alibaba Cloud CLI

The Alibaba Cloud OpenAPI has two styles, RPC style and RESTful style. Most of the Alibaba Cloud products use the RPC style. The way of calling an API varies depending on the API style.

You can distinguish the API style from the following characteristics:

  • The API requiring the Action parameter is the RPC style, while the API requiring the PathPattern parameter is the RESTful style.
  • In general, the API style for a product is consistent.
  • Each API only supports one style. If an incorrect calling method is used, another API may be called or an error ApiNotFound is returned.

Call RPC APIs

The following statement shows how to call RPC APIs in the Alibaba Cloud CLI:

aliyun <product> <operation> --parameter1 value1 --parameter2 value2 ...

Examples:

aliyun rds DescribeDBInstances --PageSize 50
aliyun ecs DescribeRegions
aliyun rds DescribeDBInstanceAttribute --DBInstanceId xxxxxx

Call RESTful APIs

APIs of some products such as Container Service are RESTful style. The way to call RESTful APIs is different from RPC APIs.

The following examples show how to call RESTful APIs in the Alibaba Cloud CLI:

  • GET request:

    aliyun cs GET /clusters
  • POST request:

    aliyun cs POST /clusters --body "$(cat input.json)"
  • DELETE request:

    aliyun cs DELETE /clusters/ce2cdc26227e09c864d0ca0b2d5671a07

Get help information

Alibaba Cloud CLI integrates API descriptions for some products, you can get help by using the following commands:

  • aliyun help: get product list

  • aliyun help <product>: get the API information of a specific product

For example, get help of ECS APIs: $ aliyun help ecs

  • $ aliyun help <product> <apiName>: get the detailed API information of a specific APU

For example, get the help information of the CreateInstance API: aliyun help ecs CreateInstance

Use the --force option

Alibaba Cloud CLI integrates the product metadata of some products. It will validate API parameters when calling the API. If an API or a parameter that is not included in the metadata is used, an error unknown api or unknown parameter will be returned. You can use the --force option to skip the validation and call the API by force as shown in the following example:

aliyun newproduct --version 2018-01-01 --endpoint newproduct.aliyuncs.com --param1 ... --force

The following two options are required when using the --force option:

  • --version: the API version. You can find the API version in the API documentation. For example, the ECS API version is 2014-05-26.
  • --endpoint: the product endpoint. Get the product endpoint in the corresponding API documentation.

Use the --output parameter

The query interface of Alibaba Cloud products will return json structured data, which is inconvenient to read. Example:

aliyun ecs DescribeInstances

Executing the above command will get the following json result:

{
  "PageNumber": 1,
  "TotalCount": 2,
  "PageSize": 10,
  "RequestId": "2B76ECBD-A296-407E-BE17-7E668A609DDA",
  "Instances": {
    "Instance": [
      {
        "ImageId": "ubuntu_16_0402_64_20G_alibase_20171227.vhd",
        "InstanceTypeFamily": "ecs.xn4",
        "VlanId": "",
        "InstanceId": "i-12345678912345678123",
        "Status": "Stopped",
        //omit some fields
      },
      Instance": [
      {
        "ImageId": "ubuntu_16_0402_64_20G_alibase_20171227.vhd",
        "InstanceTypeFamily": "ecs.xn4",
        "VlanId": "",
        "InstanceId": "i-abcdefghijklmnopqrst",
        "Status": "Running",
        //omit some fields
      },
    ]
  }
}

You can use the --output parameter to extract the fields of interest in the results and perform tabular output. Example:

aliyun ecs DescribeInstances --output cols=InstanceId,Status rows=Instances.Instance[]

Executing the above command will get the following result:

InstanceId             | Status
-----------------------|--------
i-12345678912345678123 | Stopped
i-abcdefghijklmnopqrst | Running

When using the --output parameter, the following sub-parameters must be specified:

  • cols: The column names of the table, which need to correspond to the fields in the json data. For example, the InstanceId and Status fields in the result returned by the ECS DescribeInstances interface.

Optional sub-parameters:

  • rows: Use the jmespath query statement to specify the data source of the table row in the json result.

Use --waiter parameter

This parameter is used to poll the instance information until a specific state appears.

For example, after creating an instance using ECS, the instance will have a startup process. We will continue to query the running status of the instance until the status becomes "Running".

Example:

aliyun ecs DescribeInstances --InstanceIds '["i-12345678912345678123"]' --waiter expr='Instances.Instance[0].Status' to=Running

After executing the above command, the command line program will poll the instance status at a certain time interval and stop polling when the instance status becomes Running.

When using the --waiter parameter, you must specify the following two sub-parameters:

  • expr: Specify the polled field in the json result through the jmespath query statement.
  • to: The target value of the polled field.

Optional sub-parameters:

  • timeout: polling timeout time (seconds).
  • interval: polling interval (seconds).

Special argument

When you input some argument like "-PortRange -1/-1", will cause parse error. In this case, you could assign value like this: --PortRange=-1/-1.

Supported environment variables

We support the following environment variables:

  • ALIBABA_CLOUD_PROFILE: When the --profile flag is not specified, the CLI uses it.
  • ALIBABA_CLOUD_IGNORE_PROFILE=TRUE: When this variable is specified, the CLI ignores any configuration files.
  • ALIBABA_CLOUD_ACCESS_KEY_ID: When no Access Key Id is specified, the CLI uses it.
  • ALIBABA_CLOUD_ACCESS_KEY_SECRET: When no Access Key Secret is specified, the CLI uses it.
  • ALIBABA_CLOUD_SECURITY_TOKEN: When no Security Token is specified, the CLI uses it.
  • ALIBABA_CLOUD_REGION_ID: When no Region Id is specified, the CLI uses it.
  • DEBUG=sdk:Through this variable, the CLI can display HTTP request information, which is helpful for troubleshooting.

Getting Help

We use GitHub issues to track bugs and feature requests for user feedback. Please visit the following site for assistance:

aliyun-cli's People

Contributors

ailan-gl avatar alibaba-oss avatar aliguyong avatar ayanamist avatar bryant1410 avatar cubercsl avatar cuisongliu avatar dependabot[bot] avatar fartparty avatar humanhuang avatar imbolo avatar jacksontian avatar jhgaog avatar jxyowen avatar lvscar avatar night556 avatar peze avatar qingtang-sdk avatar rjhintz avatar robberphex avatar robertvolkmann avatar rouralberto avatar sdk-team avatar sikiryl avatar tsinghuadream avatar wenzuochao avatar xiangxixids avatar xuanwo avatar yesteph avatar zhouwenb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aliyun-cli's Issues

一些建议

cli作为阿里云的一个工具,用户可能不是那么多,对用户的辅助多少也经常反馈不到整个产品上面。但既然阿里云决定将cli工具作为开源项目,是否可以更专业的对待一些。

  1. 版本不一致。此repo的代码从Readme或label看,是1.0。然而官网下载来的是2.0。从commit history上看,代码都是一坨一坨提交的,呵呵。。。
  2. 文档缺失。通过aliyuncli oss命令能查询到所有支持的oss操作命令。比如命令UploadDisk就无法在在线文档中找到。既然是开源,是否应该把文档的更新作为代码的一部分,通过CI等automation的方式来自动发布。

ARM binary release

Is it possible to leverage github release feature and put all the history releases and binaries there?

Meantime, besides popular Linux, Darwin, Windows (x86 and x64), is it possible to release additional binaries for ARM which is very useful to Raspberry Pi users?

I believe it's not a hard task since golang supports cross compiling pretty well.

Service Activation possible?

Hi everybody,

is it possible to activate services via CLI? It only seems to be possible via the graphical console which involves manual steps. Thanks!

安装sdk报错

pip install aliyun-python-sdk-ecs

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;file='/tmp/pip-build-Y0zVty/pycrypto/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-xqT68E-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Y0zVty/pycrypto/

Container Registry commands do not work

Hi --,

when running $ aliyun cr GET /namespace I get the following error:

ERROR: SDK.ServerError
ErrorCode:
Recommend:
RequestId:
Message: {"message":"","code":"rpc_invalid_arg","requestId":"0474A51A-2965-464B-8391-1F4448F62BF7"}

Region is eu-central-1, credentials used have full access. Any ideas what might be the cause? Thanks!

aliyuncli doesn't work without default profile

if ~/.aliyuncli/configure is empty, aliyuncli was failed.
I'd like you to aliyuncli work well without default profile.

  • On failure:
echo "" > ~/.aliyuncli/configure

aliyuncli rds DescribeRegions \
 --AccessKeyId *** \
 --AccessKeySecret *** \
 --RegionId "cn-hangzhou"

accesskeyid/accesskeysecret/regionId is absence
  • On success:
vi ~/.aliyuncli/configure
--
[default]
aliyun_access_key_secret =
aliyun_access_key_id =
--

aliyuncli rds DescribeRegions \
 --AccessKeyId *** \
 --AccessKeySecret *** \
 --RegionId "cn-hangzhou"

{
    "Regions": {
        "RDSRegion": [
            {
                "RegionId": "cn-qingdao", 
                "ZoneId": "cn-qingdao-b"
            }, 
...
  • Environment:
cat /etc/redhat-release 
CentOS release 6.5 (Final)

python --version
Python 2.6.6

pip list | grep aliyun
aliyun-python-sdk-core (2.1.2)
aliyun-python-sdk-ecs (2.1.1)
aliyun-python-sdk-rds (2.0.5)
aliyuncli (2.1.3)

NameError: name 'AtomicInt' is not defined

I am using CentOS 6.6, Python 2.6.6 and latest aliyuncli, the following error occurs when I use any aliyuncli command:
[root@56f20fb23c74 /]# aliyuncli configure
Traceback (most recent call last):
File "/usr/bin/aliyuncli", line 7, in
from aliyuncli.aliyuncli import main
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyuncli.py", line 25, in
import aliyunCliMain
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyunCliMain.py", line 21, in
import aliyunOpenApiData
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyunOpenApiData.py", line 22, in
import aliyunExtensionCliHandler
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyunExtensionCliHandler.py", line 24, in
import advance.userProfileHandler
File "/usr/lib/python2.6/site-packages/aliyuncli/advance/userProfileHandler.py", line 5, in
import aliyunExtensionCliHandler
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyunExtensionCliHandler.py", line 22, in
import aliyunCliHelp
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyunCliHelp.py", line 20, in
import aliyunOpenApiData
File "/usr/lib/python2.6/site-packages/aliyuncli/aliyunOpenApiData.py", line 47, in
import ossadp.ossHandler
File "/usr/lib/python2.6/site-packages/aliyuncli/ossadp/ossHandler.py", line 44, in
TOTAL_PUT = AtomicInt()
NameError: name 'AtomicInt' is not defined

文档中自动补全说明

自动补全功能:

阿里云命令行工具具备了命令行自动提示和补全的功能. 这个功能安装后不会默认打开, 需要您手动开启:
对于bash:

$ complete -C '/usr/local/bin/aliyun_completer' aliyuncli
执行报错:

[root@node01 ~]# aliyuncli -bash: /usr/local/bin/aliyun_completer: No such file or directory
-bash: /usr/local/bin/aliyun_completer: No such file or directory

执行 complete -r aliyuncli 解决报错,并替换新路径即可
实际安装,aliyun_completer 路径为 /usr/bin/aliyun_completer

无法make

无法编译

make

go get gopkg.in/ini.v1
go get github.com/aliyun/alibaba-cloud-sdk-go/...
go get -u github.com/jteeuwen/go-bindata/...
go-bindata -o resource/metas.go -pkg resource -prefix ../aliyun-openapi-meta ../aliyun-openapi-meta/**/* ../aliyun-openapi-meta/products.yml
go build -o out/aliyun main/main.go
#command-line-arguments
main/main.go:41:32: undefined: resource.NewReader
make: *** [build] Error 2

`ecs DeleteKeyPairs --KeyPairNames` returns "`KeyPairNames` is not valid"

钥匙用CreateKeyPair命令创建以后无法用DeleteKeyPairs命令删除,目前只能到网页控制台中删除。这是新加的功能吗?

$ aliyuncli ecs DeleteKeyPairs --KeyPairNames key1
{
    "Message": "The specified parameter \"KeyPairNames\" is not valid.", 
    "Code": "InvalidKeyPairNames.ValueNotSupported"
}
Detail of Server Exception:

HTTP Status: 400 Error

尝试了 'key1' 、"key1" 、{"key1"} 、["key1"],统统不行。:-(

另外,openapi有C语言、OC或者Swift版本的吗?从程序里调用命令行的太费劲儿了。

python3 is not supported to run cli

Any plan to support python3?

Traceback (most recent call last):
  File "/usr/local/bin/aliyuncli", line 7, in <module>
    from aliyuncli.aliyuncli import main
  File "/usr/local/lib/python3.6/site-packages/aliyuncli/aliyuncli.py", line 22, in <module>
    reload(sys)
NameError: name 'reload' is not defined

any problem with current release

I tested with the command described in the doc after config. But it seems those commands don't work at all:
$ pip freeze | grep ali
aliyuncli==2.1.2
$ aliyuncli configure
Aliyun Access Key ID [*************_WxyZ]:
Aliyun Access Key Secret [
_*************w4yX]:
Default Region Id [cn-hangzhou]:
Default output format [json]:
$ aliyuncli Ecs DescribeInstances
usage: aliyuncli [options and parameters]
the valid command as follows:
$ python --version
Python 2.7.9

ubuntu系统查找sdk失败

ubuntu上pip安装的目录在/usr/local/lib/python*.*/dist-packages目录下,但是使用get_python_lib只会输出/usr/lib/python*.*/dist-packages,这是系统默认库的安装目录,因此找不到安装的sdk

$ python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
/usr/lib/python2.7/dist-packages

$ python -c "import site; print(site.getsitepackages())"
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

oss只能使用杭州区?

不管我怎么设,其他区就是不能用

root@133-130-89-83:~# aliyuncli oss CreateBucket oss://meixiaozhu-shared --location oss-cn-beijing
Error Headers:

[('content-length', '327'), ('server', 'AliyunOSS'), ('connection', 'keep-alive'), ('x-oss-request-id', '5634E30FC7A7A96714A64234'), ('date', 'Sat, 31 Oct 2015 15:49:35 GMT'), ('content-type', 'application/xml')]
Error Body:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>InvalidLocationConstraint</Code>
  <Message>The specified location-constraint is not valid</Message>
  <LocationConstraint>oss-cn-beijing</LocationConstraint>
  <RequestId>5634E30FC7A7A96714A64234</RequestId>
  <HostId>meixiaozhu-shared.oss.aliyuncs.com</HostId>
</Error>

Error Status:

400
CreateBucket Failed!

然后我不制定的话就可以

root@133-130-89-83:~# aliyuncli oss CreateBucket oss://meixiaozhu-shared
0.539(s) elapsed

是我选项用错了?

Do you support oss ?

$ aliyun oss
ERROR: 'oss' is not a valid command or product. See `aliyun help`.

did you mean:
  ess

aliyun command usage error

Getting this error for every aliyun command I run

screen shot 2018-05-25 at 7 42 26 pm

ERROR: load current configuration failed unknown profile default, run configure to check

AliyunCLI处理 DataDisk.n.Category 等带n的参数无法正常匹配set方法

AliyunCLI处理 类似DataDisk.n.Category 的带“n”参数时,是去掉点号然后再从SDK源码中匹配对应的set规则,但是<class 'ImportImageRequest.ImportImageRequest'>中关于DiskDeviceMapping.1.OSSBucket 的set方法命名为'set_DiskDeviceMappings',无法完整匹配“DiskDeviceMapping1OSSBucket”名称,其他的Action可能也存在类似的问题,请评估是否可以修正这个bug,谢谢

about docker related issue

1、因为阿里云的客服系统让我困惑,效率不高,我选择在github找找有没有地方提交问题反馈。
2、问题描述
我的 docker node 使用了Docker Hub 镜像站点,然后发现一个问题:

~]$ sudo cat /etc/docker/daemon.json |grep registry
  "registry-mirrors": ["https://zvz7k9mh.mirror.aliyuncs.com"]

~]$ sudo docker pull opera443399/whoami
Using default tag: latest
latest: Pulling from opera443399/whoami
Digest: sha256:4119c322c2d9f007af8751394a63ed6809158bc39456e6aa60ab84e7a21429c5
Status: Image is up to date for opera443399/whoami:latest

~]$ sudo docker images |grep opera
opera443399/whoami         latest              160ed79ce86f        5 weeks ago         4.13MB

实际上,上述拉取到的是一个旧的版本 160ed79ce86f

对比下面操作中另一个节点的状态(没有使用加速镜像)

~]$ sudo docker pull opera443399/whoami
Using default tag: latest
latest: Pulling from opera443399/whoami
Digest: sha256:a05120d9fe157868f7f1c8b842cc860fb58665d74cadaf8eb7d6091af626cccd
Status: Downloaded newer image for opera443399/whoami:latest

~]$ sudo docker images |grep opera
opera443399/whoami          0.9                  a7878d3e0fdf        20 hours ago        4.13MB
opera443399/whoami          latest               a7878d3e0fdf        20 hours ago        4.13MB
opera443399/whoami          0.8                  ae008c956c53        3 weeks ago         4.13MB
opera443399/whoami          0.7                  160ed79ce86f        5 weeks ago         4.13MB

小结:使用阿里云的容器服务中的 Docker Hub 镜像站点后,缓存的 latest 这个 tag 是旧版本,且过了好几天还没有刷新,这个问题怎么解决?

感谢您查看,希望能帮助反馈问题。

Where is the aliyun-cli config stored?

I am a new user to Alibaba Cloud but familiar with AWS CLI where it keeps a config file in ~/.aws/config.

Where does aliyun-cli keep its config file?

(alibaba_cli) aliyuncli configure
Aliyun Access Key ID [****************j9P6]:
Aliyun Access Key Secret [****************rxJ4]:
Default Region Id [us-west-1]:
Default output format [None]:

(alibaba_cli) $ find ~/ -type f -name "config"
/home/ec2-user/cloud-custodian/.git/config
/home/ec2-user/terraform_projects/terraform-modules/.git/config
/home/ec2-user/terraform_projects/sandbox/.git/config
/home/ec2-user/.vim/bundle/Vundle.vim/.git/config
/home/ec2-user/vim/.git/config
/home/ec2-user/.aws/config
/home/ec2-user/.ssh/cloudcustodian/.git/config
/home/ec2-user/custodian/cloudcustodian/.git/config
/home/ec2-user/custodian/cloudcustodian-policies/.git/config
/home/ec2-user/boto3/.git/config

A clear statement should be provided when authentication fails

The aliyuncli ecs DescribeInstances gives SDK.InvalidRegionId and Can not find endpoint to access when authentication fails. It would be much better and clear if aliyuncli provides a statement like "SDK.InvalidCredentials" or something like "Authentication failure".

Test code:

[cheshi@cheshi-desktop1 ~]$ aliyuncli configure
Aliyun Access Key ID [****************tdse]: 
Aliyun Access Key Secret [****************FXOw]: BadCredentialsHere
Default Region Id [us-west-1]:
Default output format [json]: 
[cheshi@cheshi-desktop1 ~]$ 
[cheshi@cheshi-desktop1 ~]$ aliyuncli ecs DescribeInstances
{
"Message": "Can not find endpoint to access.", 
"Code": "SDK.InvalidRegionId"
}
Detail of Client Exception:

SDK.InvalidRegionId Can not find endpoint to access.

cli 命令疑问?

aliyuncli oss UploadObjectFromLocalDir ./ oss://ding-prod/111 --check_point upload.txt --replace true --check_md5 false --thread_num 5

这个命令为什么会上传个 upload.txt

--region option doesn't work

we want you to give terminal options higher priority before ~/.aliyuncli/configure.

  • Env:
cat ~/.aliyuncli/configure

[default]
output = json
region = cn-hangzhou

[profile development]
output = json
region = cn-hangzhou

----
cat /etc/redhat-release 
CentOS release 6.5 (Final)

python --version
Python 2.6.6

pip list | grep aliyun
aliyun-python-sdk-core (2.1.2)
aliyun-python-sdk-ecs (2.1.1)
aliyun-python-sdk-rds (2.0.5)
aliyuncli (2.1.3)

On failure:

aliyuncli ecs DescribeInstances --profile development --region us-west-1
{
    "TotalCount": 41, 
    "PageNumber": 1, 
    "RequestId": "****, 
    "PageSize": 10, 
    "Instances": {
        "Instance": [
            {
                "AutoReleaseTime": "", 
                "RegionId": "cn-hangzhou", 
...

invalid memory address when run in the docker with linux binary version

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0xae7371]

goroutine 1 [running]:
github.com/aliyun/aliyun-cli/oss/lib.DecideConfigFile(0x0, 0x0, 0xc3bb7f, 0x7)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/oss/lib/config_helper.go:57 +0x51

centos6 提示一个模块的版本不对。

centos6 最小化安装 pip install aliyuncli 后运行报错如下

Traceback (most recent call last):
File "/usr/bin/aliyuncli", line 5, in <module>
    from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: jmespath>=0.6.1,<=0.7.1

我通过
sudo pip uninstall jmespath

然后 
sudo pip install jmespath==0.7.0

然后可以用了。这是个坑。

Aliyun cli doesn't work on alpine (musl libc)

Hi, I'm trying to put the cli tool inside alpine image. But it doesn't work as expected. Could someone take a look and give a fix? Thanks.

$ docker run -v `pwd`/aliyun:/usr/local/bin/aliyun alpine aliyun help
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0xa01071]

goroutine 1 [running]:
github.com/aliyun/aliyun-cli/oss/lib.DecideConfigFile(0x0, 0x0, 0xb231f2, 0x7)
	/Users/ailan/go/src/github.com/aliyun/aliyun-cli/oss/lib/config_helper.go:57 +0x51

关于r-kvstore sdk 无法使用

通过aliyuncli r-kvstore 操作kv一直报一个错

{
    "Message": "Can not find endpoint to access.", 
    "Code": "SDK.InvalidRegionId"
}

其它jdk 都是ok的。 是否有独立的配置需要完成。

aliyuncli根本看不到help信息

# aliyuncli ecs help
usage: aliyuncli <command> <operation> [options and parameters]
<aliyuncli> the valid command as follows:

都是空的

screen shot 2016-07-13 at 13 56 06

screen shot 2016-07-13 at 13 56 59

aliyuncli 找不到 SDK

Ubuntu 系统上使用 pip 安装 aliyuncli 和 aliyun-python-sdk-rds。
运行 aliyuncli rds 时提示:
usage: aliyuncli [options and parameters]
the valid command as follows:

没有 valid command 可用。
代码中使用 from distutils.sysconfig import get_python_lib 来查找 python 的 lib 目录,但是 get_python_lib 获取到的目录为:/usr/lib/python2.7/dist-packages

而 pip 默认将包安装在 /usr/local/lib/python2.7/dist-packages 下面,所以 aliyuncli 找不到任何可用命令。

Feature request: --dryrun

It would be nice to have an option to show what would be done, instead of actually doing it.

DryRun

Does aliyun-cli support CreateVpnGateway?

Does aliyun-cli support the ability to create a VPN Gateway?

(alibaba_cli) $ aliyuncli --version
2.1.9

(alibaba_cli) $ aliyuncli vpc help | grep Create
CreateBandwidthPackage                          | CreateBgpGroup
CreateBgpPeer                                   | CreateCommonBandwidthPackage
CreateCustomerGateway                           | CreateForwardEntry
CreateGlobalAccelerationInstance                | CreateHaVip
CreateNatGateway                                | CreateNqa
CreatePhysicalConnection                        | CreatePhysicalConnectionNew
CreateRouteEntry                                | CreateRouterInterface
CreateSnatEntry                                 | CreateVSwitch
CreateVirtualBorderRouter                       | CreateVpc
CreateVpnConnection                             | DeactivateRouterInterface

I am trying to perform the equivalent management console tasks described in Configure a site-to-site connection documentation.

And I do not see "CreateVpnGateway" anywhere unless it is called something else?

name 'AtomicInt' is not defined, doesn't work at all

Doesn't work at all.

$ aliyuncli --help
Traceback (most recent call last):
  File "/usr/local/bin/aliyuncli", line 9, in <module>
    load_entry_point('aliyuncli==2.1.2', 'console_scripts', 'aliyuncli')()
  File "/Library/Python/2.7/site-packages/setuptools-3.4.4-py2.7.egg/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Library/Python/2.7/site-packages/setuptools-3.4.4-py2.7.egg/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/Library/Python/2.7/site-packages/setuptools-3.4.4-py2.7.egg/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyuncli.py", line 25, in <module>
    import aliyunCliMain
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyunCliMain.py", line 21, in <module>
    import aliyunOpenApiData
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyunOpenApiData.py", line 22, in <module>
    import aliyunExtensionCliHandler
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyunExtensionCliHandler.py", line 24, in <module>
    import advance.userProfileHandler
  File "/Library/Python/2.7/site-packages/aliyuncli/advance/userProfileHandler.py", line 5, in <module>
    import aliyunExtensionCliHandler
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyunExtensionCliHandler.py", line 22, in <module>
    import aliyunCliHelp
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyunCliHelp.py", line 20, in <module>
    import aliyunOpenApiData
  File "/Library/Python/2.7/site-packages/aliyuncli/aliyunOpenApiData.py", line 48, in <module>
    import ossadp.ossHandler
  File "/Library/Python/2.7/site-packages/aliyuncli/ossadp/ossHandler.py", line 44, in <module>
    TOTAL_PUT = AtomicInt()
NameError: name 'AtomicInt' is not defined

Two "InstanceId" related issues found in DescribeInstances

Issue 1: Multiple instances replied after I specify an InstanceId.

[aaa@aaa-laptop2 20171106_Aliyun_Performance_Testing]$ aliyuncli ecs DescribeInstances --InstanceId i-rj93nu0s9j3wkq0g0nif | grep InstanceId
                "InstanceId": "i-rj99hcysthbzoefu00yv", 
                "InstanceId": "i-rj93tjc72c6bib9ki4yt", 
                "InstanceId": "i-rj94xswj2tx5rrpeyj0i", 
                "InstanceId": "i-rj93nu0s9j3wkq0g0nif", 
                "InstanceId": "i-rj97tbgo9lk6vccplksp", 
                "InstanceId": "i-rj909znunwuzcw4yhqzo", 

Issue 2: "--InstanceIds" exists in the help page, but can't be used.

[aaa@aaa-laptop2 20171106_Aliyun_Performance_Testing]$ aliyuncli ecs DescribeInstances help | grep InstanceIds
--InstanceIds                            	| --InstanceName

[aaa@aaa-laptop2 20171106_Aliyun_Performance_Testing]$ aliyuncli ecs DescribeInstances --InstanceIds i-rj93nu0s9j3wkq0g0nif
    "Message": "The specified parameter \"InstanceIds\" is not valid.", 
    ......

添加配置文件报错

aliyun configure
Configuring profile '' in '' authenticate mode...
Access Key Id [*************1ZG]:
Access Key Secret [***************************A7e]:
Default Region Id [cn-hangzhou]:
Default Output Format [json]: json (Only support json))
Default Language [zh|en] zh:
Saving profile[] ...Done.
panic: [SDK.CanNotResolveEndpoint] Can not resolve endpoint(param = {"Domain":"","Product":"Ecs","RegionId":"cn-hangzhou","LocationProduct":"ecs","LocationEndpointType":"openAPI"}), please check the user guide

goroutine 1 [running]:
github.com/aliyun/aliyun-cli/config.DoHello(0xc4201e9848)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/hello.go:55 +0x69b
github.com/aliyun/aliyun-cli/config.doConfigure(0x0, 0x0, 0x0, 0x0, 0x1e29b60, 0x0)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/configure.go:105 +0x760
github.com/aliyun/aliyun-cli/config.NewConfigureCommand.func1(0xc4202b1b60, 0x1e29b60, 0x0, 0x0, 0x0, 0x0)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/configure.go:28 +0x87
github.com/aliyun/aliyun-cli/cli.(*Command).executeInner(0xc420118f00, 0xc4202b1b60, 0xc42000c2d0, 0x0, 0x0, 0x0, 0xc4201d4300)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:229 +0x6bc
github.com/aliyun/aliyun-cli/cli.(*Command).executeInner(0xc420119360, 0xc4202b1b60, 0xc42000c2d0, 0x1, 0x1, 0x0, 0xc4202b1b00)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:169 +0x9b9
github.com/aliyun/aliyun-cli/cli.(*Command).Execute(0xc420119360, 0xc42000c2d0, 0x1, 0x1)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:77 +0x1b4
main.main()
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/main/main.go:67 +0x61c

当我使用 aliyun configure get default 报 panic: runtime error: invalid memory address or nil pointer dereference

平台:
win10
执行:
aliyun.exe configure get default
报错:
`panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0xb0 pc=0x79ca93]

goroutine 1 [running]:
github.com/aliyun/aliyun-cli/cli.(*Flag).GetStringOrDefault(...)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/flag.go:136
github.com/aliyun/aliyun-cli/config.(*Profile).OverwriteWithFlags(0xc042082e88, 0xc042061780)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/profile.go:125 +0x1d3
github.com/aliyun/aliyun-cli/config.(*Configuration).GetCurrentProfile(0xc042083408, 0xc042061780, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/configuration.go:59 +0x1b9
github.com/aliyun/aliyun-cli/config.doConfigureGet(0xc042061780, 0xc0423cb4f0, 0x1, 0x1)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/configure_get.go:43 +0x17e
github.com/aliyun/aliyun-cli/config.NewConfigureGetCommand.func1(0xc042061780, 0xc0423cb4f0, 0x1, 0x1, 0x1, 0xc0423cb4f0)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/config/configure_get.go:29 +0x50
github.com/aliyun/aliyun-cli/cli.(*Command).executeInner(0xc0423bcd20, 0xc042061780, 0xc0420600b0, 0x1, 0x1, 0x0, 0xc042061bc0)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:226 +0x697
github.com/aliyun/aliyun-cli/cli.(*Command).executeInner(0xc0423bcc80, 0xc042061780, 0xc0420600a0, 0x2, 0x2, 0x0, 0x12ddf08)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:166 +0x998
github.com/aliyun/aliyun-cli/cli.(*Command).executeInner(0xc04205cd20, 0xc042061780, 0xc042060090, 0x3, 0x3, 0xc0423bd998, 0xc0423fc480)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:166 +0x998
github.com/aliyun/aliyun-cli/cli.(*Command).Execute(0xc04205cd20, 0xc042061780, 0xc042060090, 0x3, 0x3)
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/cli/command.go:74 +0x64
main.main()
/Users/jxyowen/Projects/go/src/github.com/aliyun/aliyun-cli/main/main.go:71 +0x877`

IllegalTimestamp

here comes an error, does anyone encounter?
python aliyuncli.py rds DescribeResourceUsage
{
"Code": "IllegalTimestamp",
"Message": "The input parameter "Timestamp" that is mandatory for processing this request is not supplied.",
"HostId": "rds.aliyuncs.com",
"RequestId": "E568668F-E794-4359-90D6-F57D7F3687C0"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.