# HG changeset patch # User Gregory Szorc # Date 2019-04-19 12:07:44 # Node ID 730edbd836d8892cb7da6d44d1f68f58e9532fb1 # Parent 8a0e03f7baf4e2639519ef787324b591bd5d9d82 automation: only iterate over our AMIs We can't delete AMIs that we don't own. Iterating over other AMIs won't work and slows down execution. Differential Revision: https://phab.mercurial-scm.org/D6283 diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -490,7 +490,7 @@ def remove_resources(c, prefix='hg-'): terminate_ec2_instances(ec2resource, prefix=prefix) - for image in ec2resource.images.all(): + for image in ec2resource.images.filter(Owners=['self']): if image.name.startswith(prefix): remove_ami(ec2resource, image)