The default Yum repositories for an EC2 AWS Linux 2 machine will install Mercurial 2.6.2. Version 5.8 is the most recent version available as of June 2021. AWS has announced that they will not be upgrading the Mercurial RPM (for us three Mercurial fans). To get a newer version of Mercurial on a AWS Linux 2 machine one needs to install it oneself. It is real easy:
# pre-requisites
sudo yum install -y python3-devel gcc
# install Mercurial from PIP
# uninstall of old mercurial was not needed
sudo pip3 install Mercurial
# check it is there
hg version
# prints 5.8 or newer
That's it!