Search code examples
network-programminggoogle-cloud-platformip-addressreserved-ip-addresses

External IP addresses gcp console and API count mismatch


Here on console, I am able to see a total of 7 resources. Which does not match with the result got from the API call. With API calls I am getting 75 resources:

External IP addresses

GCP Doc link https://cloud.google.com/compute/docs/reference/rest/v1/addresses/list

Method GET: https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/addresses

Here for us-east1 UI console shows 1 entry and API gives 4 records.

EDIT

For region us-east1 there are 4 records:

API response for region


Solution

  • As it was discussed at the comment section, you see mismatch between Cloud Console (image 1) and API request (image2) because UI shows you EXTERNAL IP and API shows INTERNAL IP.

    To solve this issue you should follow API documentation Method: addresses.list and set required items[].addressType:

    The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL.

    Furthermore, you can see EPHEMERAL IP via Cloud Console UI, but accordingly to the API documentation items[].address:

    The static IP address represented by this resource.