The paper describes experimental results on low temperature plasma-assisted molecular beam epitaxy of GaN/AlN heterostructures on both 6H-SiC and Si(111) substrates. We demonstrate that application of migration enhanced epitaxy and metal-modulated epitaxy for growth of AlN nucleation and buffer layers lowers the screw and edge(total)threading dislocation (TD) densities down to 1.7108 and 2109 cm-2, respectively, in a 2.8-μm-thick GaN buffer layer grown atop of AlN/6H-SiC. The screw and total TD densities of 1.2109 and 7.4109 cm-2, respectively, were achieved in a 1-μm-thickGaN/AlNheterostructure on Si(111). Stress generation and relaxation in GaN/AlN heterostructures were investigated by using multi-beam optical stress sensor (MOSS) to achieve zero substrate curvature at room temperature. It is demonstrated that a 1-μm-thick GaN/AlN buffer layer grown by PA MBE provides planar substrate morphology in the case of growth on Si substrates whereas 5-μm-thick GaN buffer layers have to be used to achieve the same when growing on 6H-SiC substrates.