What is the difference between domain-id and sham link ?
Have a look at RFC 4577.
Shamlink is used to make the routes from the backbone look like intra-area routes.
Domain-ID is a BGP extended community. It shows from what OSPF process the route originated.
These two terms have hardly any similarities except that they both matters when we talk about MPLS.
Domain-id : This term is used when we have MPLS clould and we are using OSPF as PE-CE routing protocol. By default Domain-id obtained from the ospf process id configured on PE routers. We can also manually change the doamin-id via doamin-id <> command under ospf process. If we have same domain-id on both PE routers, the ospf routes on each routers will be seen as O IA(inter-area) but if we have different domain-ids on these PE routers then ospf routes on each routers will be seen as O E2/1 (External). This distinction is made to determine whether coming routes are from the same vrf site or from different vrf site.
Sham link: Shame link is a logical link similar to virtual link which makes ospf adjacency across the mpls cloud therefore ospf routes learned from sham link appear as intra area routes and used for spf calculation however the actual actual traffic is still go through the cloud. Sham link set up is needed when we have a backup link on customer side but we want our traffic to take MPLS cloud as the primary path which makes more sense. Now in such a set up ospf routes from sham link and backup link both appear as intra area routes so just increasing the cost at the backup link will make sham link more prefered. While making sham link we need to make sure that the interfaces which are used for shame links should not be learned via customers network. These should only learned via mpls.
If we dont use sham link, we get O IA routes (if domain ids are same) via mpls cloud and O (intra area) route via backup link. Here there is no way we can make mpls cloud as primary because of ospf routes preference rule from more to less prefered O OIA O E1 O E2 N1 N2. By shame link we make routes comparable both as O and by adjusting cost we make mpls link as primary.
for more detail