Aliyun CLI 操作紀錄

1.設定CLI proflie

#aliyun configure --mode AK --profile profilename

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

#aliyun configure list

3.切換CLI profile

#aliyun configure set -p profilename

4.列出所有ECS EIP,並找到相應的ECS

#aliyun ecs DescribeInstances | jq -r '.Instances .Instance[] | .InstanceName, .InstanceId, .EipAddress[]' | grep wap -A 3

5.ECS 釋放EIP

#aliyun ecs UnassociateEipAddress --InstanceId i-XXXXXX --AllocationId eip-XXXXXX

6.查看 vpc 上的EIP 使用狀況

#aliyun vpc DescribeEipAddresses | jq -r '.EipAddresses .EipAddress[] | .AllocationId, .Status, .IpAddress'

快速查詢EIP是否被PR002

# aliyun vpc DescribeEipAddresses --PageSize 50 | jq -r '.EipAddresses .EipAddress[] | .AllocationId, .Status, .IpAddress, .OperationLocks[]'  | grep -A 4 47.244.131.122

7.綁定EIP 到ECS上

#aliyun ecs AssociateEipAddress --InstanceId i-XXXXXX --AllocationId eip-XXXXXX

8.綁定EIP 到SLB上

#aliyun vpc AssociateEipAddress --RegionId cn-hongkong --InstanceId i-XXXXXX --AllocationId eip-XXXXXX --InstanceType SlbInstance

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

#aliyun vpc AllocateEipAddress --RegionId cn-hongkong --Bandwidth 200 --InternetChargeType PayByTraffic

10.在VPC上釋放一組EIP

#aliyun vpc  ReleaseEipAddress --AllocationId eip-XXXXXX

11. 建立一組私網SLB

#aliyun slb CreateLoadBalancer --RegionId cn-hongkong --AddressType intranet --InternetChargeType paybytraffic --Bandwidth 200 --LoadBalancerName slb_test --VpcId vpc-XXXXXX --VSwitchId vsw-XXXXXX --LoadBalancerSpec slb.s1.small

12. 列出所有EIP 使用狀態

#aliyun vpc DescribeEipAddresses --RegionId cn-hongkong --PageSize 50 --PageNumber 1 | jq '.EipAddresses .EipAddress[]  | .Status, .IpAddress, .AllocationId'
Facebook Comments