Huawei CLI 操作紀錄

1.設定CLI proflie

#hcloud configure set --profile=XXXX --access-key=XXXX --secret-key=XXXX

2.設定列出目前設定的CLI profile

#hcloud configure list

3.切換CLI profile

#hcloud configure set --profile=XXXX

4.查詢帳戶所有彈性公網IP

#hcloud EIP ListPublicips/v2 --cli-region="ap-southeast-1" | jq -r .publicips[] | jq -r .public_ip_address

5.在VPC上買一組香港帶寬最大使用量100M的彈性EIP

#hcloud EIP CreatePublicip/v2 --cli-region="ap-southeast-1" --bandwidth.share_type="PER" --bandwidth.size=100 --bandwidth.charge_mode="traffic" --publicip.ip_version=4 --publicip.type="5_bgp" --bandwidth.name=test

6.獲取ECS Server ID

#hcloud ECS NovaListServers --cli-region="ap-southeast-1" | jq -r .servers[] | jq -r '.name, .id' | grep wap-xxcp -A 1 | grep -v wap-xxcp

7.獲取ECS port id

#hcloud ECS ListServerInterfaces --cli-region="ap-southeast-1" --server_id="876541be-f6f5-42d6-8a82-91b8ba2a3831" | jq -r .interfaceAttachments[] | jq -r .port_id

8.EIP綁定在ECS上

#hcloud EIP UpdatePublicip/v2 --cli-region="ap-southeast-1" --publicip_id="71de6a27-ca1b-4fa5-afce-a6b0a455117d" --publicip.port_id="a35bda2e-662e-467b-bd33-7978afbfbbe1"
Facebook Comments