mrjob.ami - building custom AMIs

Utilities for creating custom AMIs.


Fetch a list of Amazon Linux AMI images that are usable with EMR, with the most recent first. This can take several seconds.

Parameters:ec2_client – a boto3 EC2 client, which can be obtained from mrjob.emr.EMRJobRunner.make_ec2_client() or boto3.client('ec2')

For the sake of consistency, we have somewhat stricter requirements than the AWS documentation. Specifically:

  • Amazon Linux (not Amazon Linux 2)
  • HVM virtualization
  • x86_64 architecture
  • single EBS volume * standard volume type (not GP2)
  • stable version (no “testing” or “rc”, only numbers and dots)

This only returns images going back to September 2016 (prior to that, EC2 used a different naming convention).

This returns a dictionary for each image, in the same response format as ec2_client.describe_images(). The ImageId field contains the AMI ID, and Description contains a human-readable description.