During the attach procedure, MME fetches the subscription profile the HSS. For this purpose it sends Update-Location-Request message to HSS and get back the "Update Location Answer" in response from HSS. Update Location Answer message carries " MIP6-Agent-Info " AVP within the APN-Configuration AVP.
MIP6-Agent-Info AVP contains PGW identity as an IP address (MIP-Home-Agent-Address) or FDQN (MIP-Home-Agent-Host).
Based on that MME builds and sends Create Session Request message to SGW and in turn SGW builds and sends Create Session Request message to the PGW.
Along with MIP6-Agent-Info AVP, PDN-GW-Allocation-Type AVP would be present which actually tells IP address presents within the MIP6-Agent-Info AVP is either statically configured or dynamically.
Hope this level of information would help you.