Amazon provides a list on their website. https://aws.amazon.com/amis
Actually I was sure that it was also possible to grab and filter the list via the API but unfortunately I can't find any documentation about this (imaginary?) feature
Answer from Michel Feldheim on Stack OverflowBest way to find AMI ID of Amazon Linux 2 for each region for a CloudFormation map?
amazon ec2 - Is there a list of AMIs for every popular linux distribution and version - Stack Overflow
Can I query an AMI to find out if it is Amazon Linux 1 or 2?
Using Boto3 to fetch the AMI ID of Amazon's AL2 AMIs?
Enhanced developer productivity
Amazon Linux 2 is offered as a virtual machine and container image for on-premises development and testing. Developers can speed up their application development by building, testing, and integrating on the same Linux distribution that is used in their production environment.
Optimized performance
Amazon Linux 2 includes support for the latest Amazon Elastic Compute Cloud (Amazon EC2) instance capabilities and is tuned for enhanced performance. It includes packages that help ease integration with other AWS services.
Large partner network
Amazon Linux 2 has a rapidly growing community of AWS Partners that includes independent software vendors (ISVs). You can install and run many popular partner applications.
Videos
I want to use the Amazon Linux 2 as my AMI ID, but I can't hard code it else the cloudformation will be region bound. But I can't find the information for where the AMI ids for each region is?
Amazon provides a list on their website. https://aws.amazon.com/amis
Actually I was sure that it was also possible to grab and filter the list via the API but unfortunately I can't find any documentation about this (imaginary?) feature
You can get AMI ID from aws site
Below is how to
To find a Linux AMI using the Images page
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
From the navigation bar, select a region. You can select any region that's available to you, regardless of your location. This is the region in which you'll launch your instance.
In the navigation pane, choose AMIs.
(Optional) Use the Filter options to scope the list of displayed AMIs to see only the AMIs that interest you. For example, to list all Linux AMIs provided by AWS, select Public images. Choose the Search bar and select Owner from the menu, then select Amazon images. Choose the Search bar again to select Platform and then the operating system from the list provided.
(Optional) Choose the Show/Hide Columns icon to select which image attributes to display, such as the root device type. Alternatively, you can select an AMI from the list and view its properties in the Details tab.
The AMI ID for the platform and Distribution you have chosen would be in the AMI ID tab
More detail here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html
Instead of guessing which version of RHEL a particular distro is based off, just run:
rpm -E %{rhel}
For Amazon Linux 2, this will give you 7.
There's a discussion thread available over on the AWS forums that indicates the officially supported Amazon Linux AMI is not based upon any Linux distribution. Rather, the Amazon Linux AMI is independently maintained image by Amazon.
Given an AMI ID for an existing AMI, I can query the API or command line to find out which OS it is. For example,
aws ec2 describe-images --image-ids $AMI_ID
[...]
"PlatformDetails": "Linux/UNIX"
But for Linux AMIs, is there a way to find out which flavor of Linux it is, without actually launching an instance?
More narrowly, is there a way to find out whether this AMI was built on top of one of the official AWS Amazon Linux 1 or Linux 2 AMIs, and if so, was it AL1 or AL2?