I recently a question from one of our VMware Cloud on AWS (VMC) field folks who was looking to programmatically retrieve the SDDC Public IP Address which is shown under the NSX-T Networking & Security Overview page within the VMC Console as shown in the screenshot below.
This actually had me stumped for a bit as I was not able to find anything mentioned in the NSX-T Policy API documentation. My last resort before pinging the NSX Engineers was to use one of my favorite browser tool, Chrome Developer Tools, which allows me to inspect all requests made to a specific web page and can also be helpful in figuring out which REST APIs the UI is using.
It turns out for this particular page, the information was not actually coming from the NSX-T Policy API but rather from another endpoint and specifically /cloud-service/api/v1/infra/sddc-user-config which I am guessing has to do with the fact that some of this information is really AWS specific information such as the Public IP Address for example. In any case, once I realized what the endpoint was and that I could still use the VMC NSX-T Reverse Proxy to retrieve the details, it was pretty straight forward.
To demonstrate how this API works, I have created a new function called Get-NSXTOverviewInfo in my VMC NSX-T PowerShell Module as well as a quick shell script called list_vmc_nsxt_overview.sh using cURL.
Here is an example output of using the Get-NSXTOverviewInfo function:
In addition to the SDDC Public IP which can find under the vpn_internet_ips property field, you can also programmatically retrieve both the Management and Compute Gateway labels (mgw and cgw) which is needed when using other NSX-T Policy APIs. You can either hardcode these values as they would not change in VMC or you can programmatically retrieve them using this endpoint. The same goes for the provide_name property which has a value of vmc and other useful information such as the SDDC Appliance and Infrastructure Subnet can also be retrieved which is useful when setting up a VPN and/or Direct Connect to the SDDC.
Here is the exact same output using the shell script: