编程

huawei-cloud-ecs-eip-query

试用

Queries the EIP (Elastic IP, 弹性公网IP) bound to a single Huawei Cloud ECS instance — given an ECS ID or ECS name, returns the associated public IP address, EIP ID, status, bandwidth and binding details, using the KooCLI `hcloud EIP ListPublicips` command (primary, filtered by `vnic.device_id`) or the huaweicloudsdkeip Python SDK (fallback). Provides a read-only per-instance EIP lookup for network troubleshooting, cost review and resource discovery. Use this skill whenever the user wants the EIP of a specific ECS. Triggers include: ECS EIP query, EIP of ECS, find ECS public IP, ECS 的EIP, 查询ECS的弹性公网IP, ECS公网IP, ECS绑定的EIP, 单个ECS的eip, 查询ECS的eip, 查看ECS的弹性IP, ECS外网IP, 获取ECS公网地址.

它能做什么

Queries the EIP (Elastic IP, 弹性公网IP) bound to a single Huawei Cloud ECS instance — given an ECS ID or ECS name, returns the associated public IP address, EIP ID, status, bandwidth and binding details, using the KooCLI `hcloud EIP ListPublicips` command (primary, filtered by `vnic.device_id`) or the huaweicloudsdkeip Python SDK (fallback). Provides a read-only per-instance EIP lookup for network troubleshooting, cost review and resource discovery. Use this skill whenever the user wants the EIP of a specific ECS. Triggers include: ECS EIP query, EIP of ECS, find ECS public IP, ECS 的EIP, 查询ECS的弹性公网IP, ECS公网IP, ECS绑定的EIP, 单个ECS的eip, 查询ECS的eip, 查看ECS的弹性IP, ECS外网IP, 获取ECS公网地址.

技能文档

Huawei Cloud ECS EIP Query Skill

Overview

This skill queries the EIP (Elastic IP, 弹性公网IP) bound to a single Huawei Cloud ECS instance. Given an ECS ID or ECS name (and an optional region), it returns the associated public IP address, EIP ID, status, bandwidth, and binding metadata. It is a read-only lookup skill: it never creates, modifies or deletes EIPs or ECS instances.

Architecture:

Agent → hcloud CLI (EIP, primary) → Huawei Cloud EIP API
       ↘ huaweicloudsdkeip Python SDK (fallback)  ↗

Applicable Scenarios:

  • Check which public IP a specific ECS is using (troubleshooting connectivity)
  • Per-instance network cost review (EIP bandwidth and billing mode)
  • Resource discovery and inventory (mapping ECS → EIP bindings)
  • Compliance reporting (per-instance public exposure)

Prerequisites

  1. hcloud CLI (KooCLI) installed and authenticated — See references/cli-installation-guide.md
  2. IAM permissionsvpc:publicIps:list (list) and vpc:publicIps:get (show detail), plus ecs:servers:list / ecs:servers:get when resolving an ECS by name — See references/eip-policies.md
  3. Python 3.6+ with huaweicloudsdkeip package (SDK fallback) — pip install huaweicloudsdkeip

Credentials. KooCLI reads credentials from hcloud configure (AK/SK) or environment variables. The EIP API is region-scoped: the same account credentials used for other Huawei Cloud services work here, and --cli-region selects the region whose EIPs are queried. Never ask the user to paste AK/SK into the conversation.

Workflow

  1. Determine the ECS — accept the ECS ID directly, or resolve an ECS name to its ID first: hcloud ECS ListServersDetails --cli-region= --name=
  2. Run the queryhcloud EIP ListPublicips/v3 --cli-region= --vnic.device_id.1= (CLI primary)
  3. Handle results — Parse the EIP public IP, EIP ID, status, bandwidth and binding details; report whether the ECS has a bound EIP
  4. Fallback — If the CLI is unavailable, use the Python SDK example below

Core Commands

Query EIP by ECS ID (primary)

hcloud EIP ListPublicips/v3 --cli-region=cn-north-4 --vnic.device_id.1=

vnic.device_id is the bound ECS instance ID — this returns only the EIPs bound to that ECS.

Query EIP by ECS ID (JSON Output)

hcloud EIP ListPublicips/v3 --cli-region=cn-north-4 --vnic.device_id.1= --cli-output=json

Note: ListPublicips is a multi-version API — the version hint line (ListPublicips is a multi-version API, where the version (v3) is default...) is printed to stdout only when the /v3 version suffix is omitted. All commands in this skill use the explicit /v3 suffix, so their output is pure JSON — parse it directly with jq/python3 -c json.load (do not use tail -n +2, which would cut off the first { and break JSON parsing). If you ever run a command without the version suffix and see the hint line, drop it with tail -n +2 before parsing, or prefer the SDK fallback path below.

Resolve ECS Name to ID

hcloud ECS ListServersDetails --cli-region=cn-north-4 --name= --cli-output=json

The ECS ID is in the servers[].id field. ECS names are fuzzy matched; pass the exact name for a precise lookup.

Show ECS Detail (addresses include the public IP)

hcloud ECS ShowServer --cli-region=cn-north-4 --server_id=

The addresses field lists both fixed (private) and floating (public/EIP) addresses with OS-EXT-IPS:type of fixed or floating.

Show EIP Detail

hcloud EIP ShowPublicip/v3 --cli-region=cn-north-4 --publicip_id=

SDK Fallback Example

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkeip.v3 import EipClient
from huaweicloudsdkeip.v3.model import ListPublicipsRequest
from huaweicloudsdkeip.v3.region.eip_region import EipRegion

credentials = BasicCredentials(
    os.environ["HUAWEI_CLOUD_ACCESS_KEY"],
    os.environ["HUAWEI_CLOUD_SECRET_KEY"],
)
client = EipClient.new_builder() \
    .with_credentials(credentials) \
    .with_region(EipRegion.value_of("cn-north-4")) \
    .build()

request = ListPublicipsRequest()
request.vnic_device_id = [""]
response = client.list_publicips(request)
eips = response.publicips or []
for eip in eips:
    print(eip.id, eip.public_ip_address, eip.status, eip.associate_instance_type)
print("EIP number:", len(eips))

Parameter Confirmation

ParameterRequiredDescriptionExample
--cli-regionYesHuawei Cloud region for the CLI endpointcn-north-4
--vnic.device_id.[N]Yes (or ECS name + ListServersDetails)Filter by bound ECS instance ID--vnic.device_id.1=xxx
--project_idNoProject ID (defaults to the region's parent project)--project_id=xxx
--nameNo*ECS name to resolve to an ECS ID first--name=my-ecs
--server_idNo*ECS ID for ECS ShowServer detail lookup--server_id=xxx
--publicip_idNo*EIP ID for EIP ShowPublicip/v3 detail lookup--publicip_id=xxx
--cli-outputNoOutput format (json/table)--cli-output=json

* Used by the corresponding sub-command; the primary EIP query only needs the ECS ID and region.

Reference Documents

  • CLI Installation Guide
  • EIP and ECS Policies
  • Verification Method
  • Data Flow Diagram
  • Acceptance Criteria

KooCLI Command Format Standard

The hcloud EIP and hcloud ECS modules map directly to the Huawei Cloud EIP/ECS API operations.

FeatureDescriptionExample
Service nameEIP / ECShcloud EIP ListPublicips
Operation nameEIP/ECS API operation nameListPublicips / ShowServer
Simple parameter--key=valuehcloud EIP ListPublicips --cli-output=json
Array parameter--key.[N]=value--vnic.device_id.1=
Output format--cli-output=json/table--cli-output=json
CredentialsKooCLI configured account (AK/SK or env vars)hcloud configure

相关技能

Lists Huawei Cloud EIP (Elastic IP, 弹性公网IP) resources — enumerates all EIPs in a region with public IP address, EIP ID, status, bandwidth, associated instance and creation time, using the KooCLI `hcloud EIP ListPublicips` command (primary) or the huaweicloudsdkeip Python SDK (fallback). Provides read-only EIP inventory for network resource auditing, cost review and resource discovery. Use this skill whenever the user mentions EIP list query. Triggers include: list EIPs, EIP list, query EIP, enumerate EIPs, show EIPs, elastic IP list, public IP inventory, 查询弹性公网IP, EIP列表, 弹性公网IP列表, 查看EIP, 列出EIP, 获取EIP列表, 查询EIP, 查询公网IP.

Queries Huawei Cloud ECS (Elastic Cloud Server) resources in read-only mode. Covers ECS instances, flavors, keypairs, quotas, server groups, block devices, NICs, VNC console, launch templates, recycle bin, scheduled events, and tags. No write operations. Use this skill when the user needs to query ECS instance details, list flavors, check server status, view block devices, or inspect ECS resource attributes. Triggers include: 查询ECS, ECS实例查询, 云服务器查询, 弹性云服务器, ECS规格, ECS配额, 云服务器列表, ECS详情, query ECS, list ECS servers, show server details, ECS flavors, ECS quotas, ECS keypairs, server groups, block devices, ECS inventory, cloud server list, ecs list, ecs query, ecs show.

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance **Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion**. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

作者 huaweicloud-skills-team

通过华为云命令行工具 hcloud 调用云监控服务 CES,查询 ECS 实例的 CPU、内存、磁盘与网络指标。

作者 huaweicloud-skills-team6 次安装

面向华为云资源的只读查询能力,用于资源清点、核对与参数发现。

作者 huaweicloud-skills-team6 次安装

通过本地 Python 脚本只读查询华为云 ECS、BMS、IMS、AS 资源。

作者 huaweicloud-skills-team2 次安装