Advanced AMI Filtering with JMESPath
I recently had a need to do some “advanced” filtering of AMIs returned by the AWS CLI. I’d already mastered the use of the --filters parameter, which let me greatly reduce the number of AMIs returned by aws ec2 describe-images. In many cases, using filters alone got me what I needed. In one case, however, I needed to be even more selective in returning results, and this lead me to some (slightly more) complex JMESPath queries than I’d used before. I wanted to share them here for the benefit of my readers.
What I’d been using before was a command that looked something like this:
ec2 describe-images --owners 099720109477 \
--filters Name=name,Values="*ubuntu-xenial-16.04*" \
Name=virtualization-type,Values=hvm \
Name=root-device-type,Values=ebs \
Name=architecture,Values=x86_64 \
--query 'sort_by(Images,&CreationDate)[-1].ImageId'
The part after --query is a JMESPath query that sorts the results, returning only the ImageId attribute of the most recent result (sorted by creation date). In this particular case, this works just fine—it returns the most recent Ubuntu Xenial 16.04 LTS AMI.
Turning to Ubuntu Bionic 18.04, though, I found that the same query didn’t return the result I needed. In addition to the regular builds of 18.04, Canonical apparently also builds EKS Continue reading
SDxCentral Weekly Wrap for March 1, 2019: Huawei goes on the offensive against security claims....
The company also released research that found 97 percent of companies report problems deploying and...
Windstream files for bankruptcy; containerd graduates at CNCF; and news, partnerships, and releases...
Under its new IoT security certification program, Arm teamed up with third-body testing labs to...
The carrier has been finding that some software components are not quite able to meet the “five...
Separate reports from Synergy Research and 650 Group pegged the market at between $44 billion and...
The security vendor also expanded the platform’s capabilities, created an “Innovation...
The APIs are designed to complement ongoing work by 3GPP and other industry groups working for...


