Read the current Amazon Linux 2023 image id and keep it in a variable:
sh
AMI=$(aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --query Parameter.Value --output text)
echo $AMIdescribe-images lists images directly. This one asks for Amazon's own AL2023 images and sorts them by date, so the last entry is the newest; compare it with the parameter:
sh
aws ec2 describe-images --owners amazon --filters "Name=name,Values=al2023-ami-2023*x86_64" --query "sort_by(Images, &CreationDate)[-1].[ImageId,Name]" --output textThen look at three families side by side:
sh
aws ec2 describe-instance-types --instance-types t3.micro c5.large r5.large --query "InstanceTypes[].[InstanceType,VCpuInfo.DefaultVCpus,MemoryInfo.SizeInMiB,FreeTierEligible]" --output table