Querying the EIP Associated with an ECS
Scenarios
This section describes how to use ECS APIs and EIP APIs to query details about the EIP associated with an ECS.
Procedure
- Query details about an ECS.
- API
URI format: GET /v1/{project_id}/cloudservers/{server_id}
For details, see Querying Details About an ECS.
- Example request
GET: https://{endpoint}/v1/743b4c0428d945316666666666666666/cloudservers/893c7791-f1df-4c3d-8383-3caae9656c62
Obtain {endpoint} from the administrator.
- Example response
{ "server": { "fault": null, "id": "b8b1b475-d6c9-4733-a3db-c3a526407286", "name": "ecs-test", "addresses": { "24bbb54c-659f-4141-8db9-a957e12b6ee8": [{ "version": "4", "addr": "192.168.0.16", "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:37:de:ee", "OS-EXT-IPS:type": "fixed", "OS-EXT-IPS:port_id": "390b39b0-9a77-4ec2-ae1e-3af358f78999" }, { "version": "4", "addr": "121.xx.xx.64", "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:37:de:ee", "OS-EXT-IPS:type": "floating", "OS-EXT-IPS:port_id": "390b39b0-9a77-4ec2-ae1e-3af358f78999" }] }, "flavor": { "disk": "0", "vcpus": "2", "ram": "4096", "id": "c6s.large.2", "name": "c6s.large.2" }, "accessIPv4": "", "accessIPv6": "", "status": "SHUTOFF", "progress": null, "hostId": "604599c4eeeaa05d8865749e4c97979e14d74c6639a08460051b3a97", "updated": "2021-02-18T12:38:39Z", "created": "2021-02-18T12:37:42Z", "metadata": { "metering.image_id": "6674d782-54ba-4f04-896d-95edd50f2eb9", "metering.imagetype": "gold", "metering.resourcespeccode": "c6s.large.2.linux", "image_name": "CentOS 8.2 64bit", "os_bit": "64", "cascaded.instance_extrainfo": "stopped_release_resource:True,pcibridge:1", "metering.resourcetype": "1", "vpc_id": "24bbb54c-659f-4141-8db9-a957e12b6ee8", "os_type": "Linux", "charging_mode": "0", "__support_agent_list": "ces" }, "tags": [], "description": "", "locked": false, "config_drive": "", "tenant_id": "0b3ade290700f3612f29c005b9d16666", "user_id": "0b3ade2a03800fec1f20c005d6116666", "key_name": null, "os-extended-volumes:volumes_attached": [{ "device": "/dev/vda", "bootIndex": "0", "id": "0dc13ef4-dcf6-49d2-8d34-395d94767917", "delete_on_termination": "true" }], "OS-EXT-STS:task_state": null, "OS-EXT-STS:power_state": 4, "OS-EXT-STS:vm_state": "stopped", "OS-EXT-SRV-ATTR:host": "604599c4eeeaa05d8865749e4c97979e14d74c6639a08460051b3a97", "OS-EXT-SRV-ATTR:instance_name": "instance-003ef12a", "OS-EXT-SRV-ATTR:hypervisor_hostname": "5edb1b44af14ebaaa784cfba010f78f113b1fd0865fef854c264a925", "OS-DCF:diskConfig": "MANUAL", "OS-EXT-AZ:availability_zone": "cn-east-3c", "os:scheduler_hints": { }, "OS-EXT-SRV-ATTR:root_device_name": "/dev/vda", "OS-EXT-SRV-ATTR:ramdisk_id": "", "enterprise_project_id": "0", "OS-EXT-SRV-ATTR:user_data": null, "OS-SRV-USG:launched_at": "2021-02-18T12:37:57.000000", "OS-EXT-SRV-ATTR:kernel_id": "", "OS-EXT-SRV-ATTR:launch_index": 0, "host_status": "UP", "OS-EXT-SRV-ATTR:reservation_id": "r-q8xjhqzk", "OS-EXT-SRV-ATTR:hostname": "ecs-test", "OS-SRV-USG:terminated_at": null, "sys_tags": [{ "key": "_sys_enterprise_project_id", "value": "0" }], "security_groups": [{ "id": "d0d30ee2-5b34-44d4-b5a3-68b9d64e7286", "name": "Sys-WebServer" }], "image": { "id": "6674d782-54ba-4f04-896d-95edd50f2eb9" }, "hypervisor": null, "auto_terminate_time": "" } }
- API
- Query EIP details.
- API
URI format: GET /v1/{project_id}/publicips
For details, see Querying EIPs.
- Example request
GET: https://{endpoint}/v1/743b4c0428d945316666666666666666/publicips?public_ip_address=121.xx.xx.64
Obtain {endpoint} from the administrator.
Obtain the EIP specified by public_ip_address from the returned information in 1. In the address field under server in the response body, locate the addr field whose OS-EXT-IPS:type is floating. The value of addr is the EIP.
- Example response
{ "publicips": [{ "id": "92597d39-b81d-42b0-8d02-fe8afe7ef076", "type": "5_bgp", "port_id": "390b39b0-9a77-4ec2-ae1e-3af358f78999", "public_ip_address": "121.xx.xx.64", "private_ip_address": "192.168.0.16", "status": "ACTIVE", "tenant_id": "0b3ade290700f3612f29c005b9d16666", "create_time": "2021-02-18 12:38:08", "bandwidth_id": "3a087bbd-0bcf-4401-9e2b-6a96fa2e3471", "bandwidth_name": "ecs-test-bandwidth-891e", "bandwidth_share_type": "PER", "bandwidth_size": 5, "profile": {}, "enterprise_project_id": "0", "ip_version": 4 }] }
- API
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.