A high temperature AlN template was grown on sapphire substrate by metalorganic chemical vapor deposition.AFM results showed that the root mean square of the surface roughness was just 0.11 nm.Optical transmission spectrum and high resolution X-ray diffraction(XRD)characterization both proved the high quality of the AlN template.The XRD(002)rocking curve full width at half maximum(FWHM)was about 53.7 arcsec and(102)FWHM was about 625 arcsec.The densities of screw threading dislocations(TDs)and edge TDs wereestimated to be - 6 × 10^6 cm^-2 and - 4.7 ×10^9 cm^-2. AlGaN of Al composition 80.2% was further grown on the AlN template. The RMS of the surface roughness was about 0.51 nm. XRD reciprocal space mapping was carried out to accurately determine the Al composition and relaxation status in the AlGaN epilayer. The XRD (002) rocking curve FWHM of the AIGaN epilayer was about 140 arcsec and (102) FWHM was about 537 arcsec. The density of screw TDs was estimated to be - 4 × 10^7 cm^-2 and that of edge TDs was - 3.3 × 10^9 cm^-2. These values all prove the high quality of the AlN template and AlGaN epilayer.