Things have become interesting, because a lot of people want Stanford names pointing to outside-world IPs, and vice-versa.
Although it had previously been prohibited, it has been possible for a while to have 3rd (4th, 5th) -level domains. Although it can be more work for you. It's often best to just use some_name.stanford.edu. You can have custom domains, but they need a lot of justification that they meet the mission of the University. Contact Phil Reese for more information. It's often better to have the non-Stanford domain just redirect to something.stanford.edu.
Networking has 5 internal DNS severs, living behind the names "ice" and "iron". Anycast is used to send queries to whichever is online and closest to you. A combination of the three "A" DNS servers (avallone, atalante and argus) and 3 off campus servers from DNS Made Easy provide DNS service for the outside world. xxxx.stanford.edu domains will go to the internal and external DNS servers; that includes domains which only have private IPs. xxxx.sunet domains will go to the internal DNS servers, but not the external servers. xxxx.nodomain domains will live in NetDB, but not go to any DNS. It is best that systems with only private IPs be put into the 'sunet' domain.
DNS supports "cascading alises", where 'a' is an alias for 'b', which is an alias for 'c', and so on. NetDB only supports one level of aliasing, but it's possible for a stanford.edu domain to be an alias for an outside domain, which then cascades. MX records can only point to IP addresses, not aliases.
Everyone with NetDB access has the ability to create entries in the stanford.edu domain. You can have sub-domains (like cs.stanford.edu) where access to that domain is limited to people in a specific group. In NetDB, domains can also be nodes: For example, cs.stanford.edu is a node (a web site) and a domain. If you want something.stanford.edu to be an alias for a non-Stanford domain name (for example, a domain in AWS), that can be done, but the target domain must be created first. It will take time, but it can be done; submit a HelpSU. Many AWS domains (for example, for ELB) already exist in NetDB; you can ask for your group to be granted access to create entries in that domain.
From time to time, you also have to point directly to a non-Stanford IP (like, an AWS or GCP IP). In those cases, either Networking can attach the IP to your NetDB node, or (if you are going to do this a lot) you can get access to use IPs from the AWS IP range.
Domains and node names are cached by DNS clients. By default, domain name information (like for stanford.edu) is cached for 48 hours. For individual names (like x.stanford.edu), those answers are cached for 30 minutes. So, when changing things like IPs, you should keep the old IPs working for at least 30 minutes after the change.
It is possible for a stanford.edu domain (like lagunita.stanford.edu) to be hosted by an outside party. That's a "delegation", and can be set up by sending in a HelpSU (once you have set up the outside DNS service). Wildcard domains (like *.laneproxy.stanford.edu) can also be setup, again by submitting a HelpSU.

