USGs commonly want to be provisioned via their LAN interfaces which can be a pain when you have a cloud / external controller. The example below shows connecting a USG to an external UniFi controller via the WAN port of the USG (natively DHCP client).


Connect to serial console (115200) or SSH to the LAN interface 192.168.1.1 (default credentials ubnt/ubnt)
Run the below commands substituting the DNS name 'unifi' & the IP address for something appropriate that points to your UniFi controller.

configure
set system static-host-mapping host-name unifi alias setup
set system static-host-mapping host-name unifi inet 203.21.38.xxx
commit
save
exit


Adopt in the controller UI & wait. You can also the command 'unifi info' for status at the CLI of the USG, be patient though as it takes a few minutes to adopt.