RedHat is big, it has a lot of revenue, but it also has a looot of expenses too. Hence it's profitability is low. Whereas Amazon is a lot more profitable (even if it had no accounting profit), and that's exactly how it grew this big.
If RH were this profitable it would have probably also grown bigger too.
Of course some business models, sectors are truly niches, and you can't grow arbitrarily big. RH probably suffered from this to a degree. Selling Linux support is a niche market compared to selling almost everything that can be shipped in boxes. Of course both Amazon and RH are survivors of the early 2000s big boom-bust cycle, so probably there's a big survival bias and chance/luck at play here, so it's probably not right to say that RH should have expanded to bigger markets. (How come "AWS" is not a RH thing? It's likely that Amazon's extreme "black friday" scaling challenge it not unique to them, yet they were the ones able to successfully capitalize on this.)