I ran into the same error message when attempting to create an Amazon Linux 2 instance using the AWS CDK. The CDK currently defaults to Amazon Linux instead of Amazon Linux 2. When you accidentally use an Amazon Linux AMI from 2018, surprise surprise, all sorts of facilities are not available. I posted an easy way to check your version in another answer.

In CDK (and Cloud Formation) make sure to declare your intended generation in your AmazonLinuxImage properties

generation: AmazonLinuxGeneration.AMAZON_LINUX_2
Answer from Derek Bennett on serverfault.com
🌐
AWS re:Post
repost.aws › knowledge-center › ec2-install-extras-library-software
Install software from the Extras Library on an AL2 EC2 instance | AWS re:Post
June 18, 2025 - Example output: $ sudo amazon-linux-extras enable php8 .1Topic php8.1 has end-of-support date of 2024-11-25 2 httpd_modules available [ =1.0 =stable ] 3 memcached1.5 available \ [ =1.5.1 =1.5.16 =1.5.17 ] 9 R3.4 available [ =3.4.3 =stable ] ...
Discussions

Amazon Linux 2
Kernel version for Amzn Linux 2 is 4.14. That is significantly newer than the CentOS kernel 3.10. The packages come from amazon's own repos so many will be different versions than what is available on CentOS. For example the FAQ on amazon linux 2 lists glibc as version 2.26 while CentOS7 is on 2.17. General use things like systemctl start/stop and yum install work the same. I wouldn't expect/count on binary compatibility between programs compiled on CentOS to run on amazon linux 2 though. It is really its own unique distribution. More on reddit.com
🌐 r/aws
5
5
May 23, 2019
amazonlinux:2022 not support amazon-linux-extras command
Hi, I'm try to use amazonlinux:2022 as our base image, and I can see [amazon-linux-extras] this command everywhere. but actually I got command not found after input amazon-linux-extras install ... More on github.com
🌐 github.com
2
September 8, 2022
amazon-linux-extras on EB for Amazon Linux 2023
I have set up an .ebextensions file in a Java deployment on EB to add additional metrics to cloud watch. Just recently tried deploying this to Amazon Linux 2023 with Corretto 17. It's failing to install sudo amazon-linux-extras install collectd -y More on repost.aws
🌐 repost.aws
1
0
September 28, 2023
Scripting amazon-linux-extras?
I think I found the proper solution. Rather than doing amazon-linux-extras install, I'm now doing amazon-linux-extras enable which allows the package to be installed via yum. My ansible snippet: name: Enable amazon-linux-extras packages shell: "amazon-linux-extras enable {{item.name}}" become: yes with_items: "{{ amazon_linux_extras_packages }}" More on reddit.com
🌐 r/aws
3
7
June 28, 2018
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › al2 extras library
AL2 Extras Library - Amazon Linux 2
See the EPEL section of the Amazon Linux 2023 User Guide for options for some EPEL packages. With AL2, you can use the Extras Library to install application and software updates on your instances. These software updates are known as topics. You can install a specific version of a topic or omit ...
🌐
Super User
superuser.com › questions › 1487748 › unable-to-find-or-install-amazon-linux-extras
Unable to find or install amazon-linux-extras - Super User
Generally, if you need to install on Amazon Linux 2 you should build from source. The code below is generally the method today, but it is typical to add/want extra modules which may modify the flags for ./auto/configure, for example.
Find elsewhere
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › al2 on amazon ec2 › configure al2 instances › manage software on your al2 instance › add repositories on an al2 instance
Add repositories on an AL2 instance - Amazon Linux 2
After you install a repository, you must enable it as described in the next procedure. Use the yum-config-manager command with the --enable repository flag. The following command enables the Extra Packages for Enterprise Linux (EPEL) repository from the Fedora project.
🌐
Medium
mavisec.medium.com › install-a-software-package-from-the-extras-library-on-an-ec2-instance-f0ecdb6b94b2
Install a software package from the Extras Library on an EC2 instance - mavisec - Medium
November 21, 2021 - Then, list the available software packages, enable the one you’re looking for, and then install the package using yum. Connect to your EC2 Linux Instance using SSH. 2. Confirm if the amazon-linux-extras package has been installed using the ...
🌐
AWS
docs.aws.amazon.com › amazon linux 2 › release notes › amazon linux 2 release notes › amazon linux 2 release notes for 2020 and earlier › amazon linux 2 release notes
Amazon Linux 2 release notes - Amazon Linux 2
The extras mechanism provides the ... Amazon Linux 2. You can use it to balance operating system stability and overall software “freshness”. Extras provides topics to select AWS curated software bundles. Each topic contains all the dependencies required for the software to install and run on ...
🌐
Milliondollarserver
blog.milliondollarserver.com › 2018 › 09 › amazon-linux-2-add-epel-repository-and.html
MILLION DOLLAR SERVER: Amazon Linux 2 add EPEL repository and install SSMTP
[ec2-user@ip-10-10-10-10 ~]$ sudo amazon-linux-extras install epel Installing epel-release Loaded plugins: extras_suggestions, langpacks, priorities, update-motd amzn2extra-docker | 1.3 kB 00:00:00 amzn2extra-epel | 1.3 kB 00:00:00 amzn2extra-epel/2/x86_64/primary_db | 1.8 kB 00:00:00 Resolving ...
🌐
AWS
docs.aws.amazon.com › corretto › corretto 8 user guide › amazon corretto 8 guide for linux › amazon corretto 8 installation instructions for amazon linux 2 and amazon linux 2023
Amazon Corretto 8 Installation Instructions for Amazon Linux 2 and Amazon Linux 2023 - Amazon Corretto 8
Enable the yum repository in Amazon Linux 2. This is not required on Amazon Linux 2022 and later. ... You can install Amazon Corretto 8 as either the runtime environment (JRE) or the full development environment (JDK).
🌐
GitHub
github.com › amazonlinux › container-images › issues › 80
amazonlinux:2022 not support amazon-linux-extras command · Issue #80 · amazonlinux/container-images
September 8, 2022 - Hi, I'm try to use amazonlinux:2022 as our base image, and I can see [amazon-linux-extras] this command everywhere. but actually I got command not found after input amazon-linux-extras install xxx. By the way, the default yum repo provid...
Author   amazonlinux
🌐
Stack Overflow
stackoverflow.com › questions › tagged › amazon-linux-extras
Newest 'amazon-linux-extras' Questions - Stack Overflow
It appears that Amazon Linux 2 v5.0 image (Amazon Linux 2 x86_64 standard:5.0 runtime available to CodeBuild) no longer contains Amazon Linux Extras, which makes a lot of documentation and answers ... ... I have a Django application hosted on an EC2 instance that I deploy manually via eb deploy. This is my production instance, and works fine. The Ec2 instance is an Amazon Linux 2 Platform. I'm standing ... ... I am trying to install docker engine on amazon linux 2023 using the docker ce repo with no luck.
🌐
ClassMethod
dev.classmethod.jp › articles › how-to-work-with-amazon-linux2-amazon-linux-extras
Amazon Linux 2のExtras Library(amazon-linux-extras)を使ってみた | DevelopersIO
$ sudo amazon-linux-extras install php7.2 Package php-cli-7.2.0-3.amzn2.1.x86_64 already installed and latest version Package php-fpm-7.2.0-3.amzn2.1.x86_64 already installed and latest version Package php-json-7.2.0-3.amzn2.1.x86_64 already ...
🌐
Fedora Project
fedoraproject.org
Fedora Linux | The Fedora Project
These may be installed as standalone full versions of Fedora or as add-ons to existing Fedora installations.Learn more · Here you will find the Minimal Fedora Linux image, Fedora's online installer, versions of Fedora Linux packaged as containers that can be run on other operating systems, BitTorrent links, and more.Learn more
🌐
Alvinyeoh
alvinyeoh.com › tech › aws-linux-ami-2-extra-modules › 1841
AWS Linux AMI 2 Extra Libraries – alvinyeoh.com
November 12, 2020 - AWS Linux AMI 2 Extra Libraries · 0 0 0 · Tech · Alvin 17 October 2020 · 0 · Reference: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-install-extras-library-software/ Summary · amazon-linux-extras · amazon-linux-extras enable php7.4 · amazon-linux-extras enable nginx1 ·
🌐
LinkedIn
linkedin.com › pulse › docker-aws-amazon-linux-2-instance-steven-aranibar
Docker On AWS Amazon Linux 2 Instance
February 8, 2021 - $ ls /etc/yum.repos.d/ Remove the docker-ce repo · $ sudo rm /etc/yum.repos.d/docker-ce.repo · Now that the docker-ce.repo has been removed I follow the AWS docker tutorial. $ sudo yum update -y · $ sudo amazon-linux-extras install docker ·