參考文檔: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"}