apt-get command not Found AWS EC2 Error [Solved]


Borislav Hadzhiev

Last updated: Aug 25, 2022


Photo from Unsplash

apt-get command not Found AWS EC2 Error [Solved] #

The AWS EC2 "apt-get: command not found" error occurs when we try to use the apt-get package manager on an EC2 instance that is launched with a non-Debian Amazon Machine Image.


To solve the "apt-get: command not found" error replace apt-get with yum, e.g. sudo yum install curl. The yum package manager is used in all Amazon Linux AMIs.

sudo yum install curl

install with yum

Yum is the primary package manager for Amazon Linux AMIs and Red Hat Linux systems.

If the error persists after trying the yum command, you have to verify which AMI your EC2 instance is launched with:

  1. Open the AWS EC2 console and click on the check box next to the instance's name
  2. Scroll down to the Instance details section and open the AMI ID in a new tab

open ami id

  1. Select Public images from the dropdown filter and look at the details of your AMI

ami details

  1. Lastly, google around and find out which package manager your AMI uses

Further Reading #

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.