Install EPEL and Java on Amazon Linux 2 - another method

EPEL:

sudo amazon-linux-extras install epel
Java:
sudo amazon-linux-extras install java-openjdk11
To check all possible options, just invoke:
amazon-linux-extras