Compared to the AlGaN alloy, which can only be grown under tensile strain on GaN, the AlInN alloy is predicted by Vegard's law to be lattice-matched (LM) on fully relaxed GaN templates for an indium content of similar to 17.5%, i.e., it can be grown either tensely or compressively on GaN. The effect of strain on the polarization induced sheet charge density at the Al1-xInxN/AlN/GaN heterointerfaces is carefully investigated for 6 and 14 nm thick AlInN barriers including a 1 nm thick AlN interlayer. The barrier indium content ranges at 0.03 <= x <= 0.23 for 6 nm thick barriers and 0.07 <= x <= 0.21 for 14 nm thick barriers. It is found that the two-dimensional electron gas (2DEG) density varies between (3.5 +/- 0.1)x10(13) cm(-2) and (2.2 +/- 0.1)x10(13) cm(-2) for 14 nm thick barriers. Finally, a 2DEG density up to (1.7 +/- 0.1)x10(13) cm(-2) is obtained for a nearly LM AlInN barrier with similar to 14.5% indium on GaN as thin as 6 nm. (c) 2008 American Institute of Physics.