参考文档:html
https://help.aliyun.com/document_detail/25484.html?spm=a2c4g.11186623.3.2.b57vQpgolang
步骤ubuntu
morya@hostname:~ $ aliyun configure list Profile | Credential | Valid | Region | Language --------- | ------------------ | ------- | ---------------- | -------- default | AK:*** | Invalid | | en * | AK:***Lmm | Valid | cn-hongkong | zh
aliyun configure
则能够用来配置默认region和access-id/access-key。工具
指令阿里云
--InternetMaxBandwidthOut=4
表明出口带宽 4Mbps,不设置这个,默认是0,会致使后面没法分配公网ip。code
aliyun ecs CreateInstance --ImageId="ubuntu_16_0402_64_20G_alibase_20180409.vhd" --InternetMaxBandwidthOut=4 --InstanceType="ecs.t5-lc2m1.nano" --ZoneId="cn-hongkong-b" --KeyPairName="abc-rsa"
返回值htm
{"InstanceId":"i-ABCDEEE783ndvzd3","RequestId":"BABABAB-0035-4FBF-9568-C123412341234"}
阿里云主机默认配置未分配公网IP,须要单独经过接口申请。接口
aliyun ecs AllocatePublicIpAddress --InstanceId="i-ABCDEEE783ndvzd3"
aliyun ecs StartInstance --InstanceId="i-ABCDEEE783ndvzd3"
须要传入前面建立时返回的instanceID来删除。ip
aliyun ecs DeleteInstance --InstanceId="i-ABCDEEE783ndvzd3"
返回值文档
{"RequestId":"AABBDDEE-49FE-45BB-AA10-AABBCCDDCCDD"}