I started to compile and install through the golang source code of aliyuncli (note: the python version of aliyuncli is no longer maintained), but it was unsuccessful. For details, please refer to the error of compiling Alibaba Cloud command line tool aliyuncli through golang source code
Later, it was changed to directly download the compiled aliyuncli
wget -qO- http://aliyun-cli.oss-cn-hangzhou.aliyuncs.com/aliyun-cli-linux-3.0.0-amd64.tgz | tar xvz -C /usr/local/bin
Configure the access key through the aliyun configure command before use
# aliyun configure Configuring profile '' in '' authenticate mode... Access Key Id []: xxx Access Key Secret []: yyy Default Region Id []: cn-hangzhou Default Output Format [json]: json (Only support json)) Default Language [zh|en] en: Saving profile[] ...Done.
Enable autocompletion
echo 'complete -C /usr/local/bin/aliyun aliyun' >> .bash_profile
Then use the command below to buy a pay-as-you-go server
aliyun ecs CreateInstance \ --RegionId cn-hangzhou (region) \ --ZoneId cn-hangzhou-b (available zone) \ --InstanceChargeType PostPaid (pay-as-you-go) \ --IoOptimized optimized (IO optimization) \ --InstanceType ecs.n4.xlarge (instance specification) \ --ImageId m-xxx(image ID) \ --VSwitchId vsw-xxx(VPC switch ID) \ --InternetChargeType PayByTraffic (public network is billed by usage flow) \ --InternetMaxBandwidthOut 1 (the maximum bandwidth of the public network) \ --SecurityGroupId sg-xxx(security group ID) \ --HostName webserver-temp(hostname) \ --InstanceName webserver-temp (instance name)
Execute the above command to complete the purchase, but the current problem:
1) Although InternetChargeType and InternetMaxBandwidthOut are specified, the created server is not assigned a public IP
2) After the server is created, it is in a stopped state and cannot be started automatically
3) Lack of parameters to know the release time
。。。
to continue research