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 - Just trying to install Java 11 from amazon-linux-extras, with out luck. ... [ec2-user@ip-172-31-99-999 ~]$ sudo yum install -y amazon-linux-extras Last metadata expiration check: 0:09:51 ago on Tue Apr 4 14:04:54 2023.
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › al2 extras library
AL2 Extras Library - Amazon Linux 2
[ec2-user ~]$ sudo amazon-linux-extras install topic=version topic=version · To remove a package installed from a topic, use the following command. [ec2-user ~]$ sudo yum remove $(yum list installed | grep amzn2extra-topic | awk '{ print $1 }')
Discussions

node.js - sudo: amazon-linux-extras: command not found - Stack Overflow
I found another way to install nginx1. I just solved the problem ... SO is a programming Q&A platform and this question is not about programming. What topics can I ask about here? Please delete this. ... Check the Amazon image version of your EC2 instance. ... If it is Amazon Linux 2023, it does not have extras. However, most of the packages are already included in the distro. You can run sudo yum ... More on stackoverflow.com
🌐 stackoverflow.com
ansible - amazon-linux-extras enable vs install - Stack Overflow
amazon-linux-extras install ansible2 enables the yum repositories and installs the latest version of ansible 2. More on stackoverflow.com
🌐 stackoverflow.com
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
How to install docker on Amazon Linux2 - Stack Overflow
My OS is Redhat Linux. I get to install docker by · yum-config-manager --enable rhui-REGION-rhel-server-extras sudo yum -y install docker systemctl start docker systemctl enable docker docker version ... Save this answer. ... Show activity on this post. ... Thanks, Prasad. I got no amazon-linu... More on stackoverflow.com
🌐 stackoverflow.com
🌐
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 - To install a software package from the Extras Library, first confirm that the amazon-linux-extras repository is installed on your instance. Then, list the available software packages, enable the one you’re looking for, and then install the package using yum.
🌐
Super User
superuser.com › questions › 1487748 › unable-to-find-or-install-amazon-linux-extras
Unable to find or install amazon-linux-extras - Super User
[arjun@ip-172-31-32-27 ~]$ which ...sr/sbin:/home/arjun/.local/bin:/home/arjun/bin) [arjun@ip-172-31-32-27 ~]$ sudo yum -y install amazon-linux-extras [sudo] password for arjun: Loaded plugins: extras_suggestions, langpacks, ...
🌐
Bobcares
bobcares.com › blog › install-a-software-package-from-the-extras-library-on-ec2
Install a software package from the Extras Library on EC2
August 15, 2021 - $ sudo amazon-linux-extras enable php7.3 0 ansible2 available [ =2.4.2 =2.4.6 ] 2 httpd_modules available [ =1.0 ] 3 memcached1.5 available [ =1.5.1 ] 4 nginx1.12 available [ =1.12.2 ] 5 postgresql10 available [ =10 ] 6 redis4.0 available [ =4.0.5 =4.0.10 ] 7 R3.4 available [ =3.4.3 ] 8 rust1 ...
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › al2 on amazon ec2 › configure al2 instances › manage software on your al2 instance › find and install software packages on an al2 instance
Find and install software packages on an AL2 instance - Amazon Linux 2
For more information, see Package management tool in the Amazon Linux 2023 User Guide. You can use the yum search command to search the descriptions of packages that are available in your configured repositories. This is especially helpful if you don't know the exact name of the package you want to install. Simply append the keyword search to the command; for multiple word searches, wrap the search query with quotation marks. ... The following is example output. Loaded plugins: extras_suggestions, langpacks, priorities, update-motd ============================== N/S matched: find =============
Find elsewhere
🌐
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
This topic describes how to install and uninstall Amazon Corretto 8 on a host or container running the Amazon Linux 2 or Amazon Linux 2023 operating systems. Enable the yum repository in Amazon Linux 2. This is not required on Amazon Linux 2022 and later. sudo amazon-linux-extras enable corretto8 ·
🌐
Amazon Web Services
aws.amazon.com › compute › amazon linux 2 › faqs
Amazon Linux 2 FAQs
1 week ago - Yes, Amazon Linux 2 supports 32-bit applications and libraries. If you are running on a version of Amazon Linux 2 that was launched before 10/04/2018, you can run “yum upgrade” to get the full 32-bit support. Yes, the MATE desktop environment is provided as an extra in Amazon Linux 2.
🌐
GitHub
gist.github.com › npearce › 6f3c7826c7499587f00957fee62f8ee9
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command · GitHub
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/ sudo amazon-linux-extras install docker sudo service docker start sudo usermod -a -G docker ec2-user
🌐
Amazon Web Services
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
January 13, 2023 - 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.
🌐
CloudKatha
cloudkatha.com › home › can you install amazon-linux-extras in amazon linux 2023?
Can you Install amazon-linux-extras in Amazon Linux 2023? - CloudKatha
July 31, 2023 - Short answer is No. amazon-linux-extras is not available in Amazon Linux 2023. However you can install any newer version of package from the
🌐
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