I would like to make an API call or use a CLI request (or multiple ones) that returns all instance types compatible with a given AMI (ami-0d59bcc339de8a2ab - Debian Buster ARM64). Here is my solution:
Find out the parameters of the AMI (CPU architecture and virtualization type)
aws ec2 describe-images --image-ids ami-0d59bcc339de8a2ab
List the machine types that meet the requirements of the AMI
aws ec2 get-instance-types-from-instance-requirements \
--architecture-types ARCHITECTURE_TYPE \
--virtualization-types VIRTUALIZATION_TYPE \
--instance-requirements "VCpuCount={Min=1},MemoryMiB={Min=1024}" \
--region eu-west-1 \
--query InstanceTypes \
--output text
But trying to launch some instances from the list (e.g. c7g.4xlarge
) I get the following message:
Error: creating EC2 Instance: UnsupportedOperation: The instance configuration for this AWS Marketplace product is not supported. Please see the AWS Marketplace site for more information about supported instance types, regions, and operating systems.
I have also filtered them by availability zone, but this doesn't help.
I know that it is possible in the Launch Instance Wizard (old version*) where unsupported instances are marked, but I am not interested in such manual solutions.
Should I consider any other parameters, that are vital to compatibility?
*Strange things: lists of available machines differ in old and new versions of the Wizard.