Instead of searching through all AMIs, it's arguably better to use the official symbolic binding to "latest AMI" that Amazon publishes. E.g. this shows promise:
ubik aws-json ssm get-parameters-by-path --loc=us-west-2 \
'{ Path: "/aws/service/ami-amazon-linux-latest" }' \
:: '.Parameters[] | select(.Name | test("al2023-ami-kernel-6[.][0-9]+-x86_64"))'
…and likewise but for ARM by testing for al2023-ami-kernel-6.1-arm64.
See https://docs.aws.amazon.com/linux/al2023/ug/get-started.html.