An EC2 instance can be created for different types of OSs. If you want to create an EC2 instance with apt-get, try to create it from ubuntu AMI (i.e ubuntu 20.04). The one you have is based on Centos or Redhat, which are using yum as a package manager not apt. Hope this makes your doubt clearer!!