Description
The Deregister AMI Images action can be used to delete many AMI images based on specific criteria.
For example, it can be used to:
deregister all images
deregister all images older than 7 days
deregister only images that contain "backup" in it's name.
deregister images that contain "backup" in it's name and are older than 5 days
Test Mode
The Deregister Images action includes a "test mode" as a way of determining which images will be deregistered without actually deregistering the images. This way, you can fine tune your action without concern for deregistering the wrong images. Test Mode is on by default.
When test mode is enabled, execute your action normally then check the action logs to verify that only images that should have been deregistered would have been deregistered, and that images that should not have been deregistered would not have been deregistered.
When you are satisfied, disable Test Mode.
Settings
Please see Common Action Settings for a description of settings common to all action types.
Image Identification Method
Indicates the method in which images will be selected for possible deletion. Options include:
All Images
By Image Name
By Snapshot Description
By Name Tag
By Resource Tag
Resource Tag Name
Required if "Image Identification Method" is set to "By Resource Tag". Specifies the name of the resource tag to use for comparison when selecting images.
Comparison
Required if "Image Identification Method" is not set to "All Images". Specifies the comparison to use when selecting images.
Delete Scheme
Indicates the deletion scheme used to decide if images should be deleted or preserved. Options include:
Deregister All Images - All images selected will be deleted.
Simple, Oldest First - Older images will be deleted based on age, newer images will be preserved.
Grandfather-Father-Son - Images will be preserved based on a minimum number of daily, weekly, monthly, and yearly images.
Older Than
Only images older than the specified number of days will be deleted.
Minimum To Keep
Indicates the minimum number of images to keep. Newer images are favoured to keep over older images.
Grouping Method
When enabled, the action group images together and apply delete scheme on each group independently. Possible options include:
None - No grouping will occur.
By Resource Tag - Images will be grouped based on the value of a specified resource tag.
Grouping Resource Tag Name
Name of the resource tag to use to group images.
Delete Associated Snapshots
By default, when an AMI image is deregistered, the snapshots used to store volume data are not deleted. Enable this option to also delete the associated snapshots. Applies to EBS-backed AMI images only.
Delete Image Data From S3s
By default, when an AMI image is deregistered, the image data in S3 is not deleted. Enable this option to also delete the data from S3. Applies to S3-backed AMI images only.
Report Target
Indicates the method in which the report will be sent.
Target Email
Indicate the target email address to which the reports will be sent. Possible options include:
Primary
Alternates
Alternate Email Addresses
Indicates the alternate email addresses to which the reports will be sent.
Report Format
Specify the format of the report. Possible options include:
Email
HTML file emailed
CSV file emailed
Test Mode
Enables and disabled Test Mode (see above).
Amazon Commands Used
The following Amazon AWS commands are used. The access key should have permission to execute all of them.
ec2:DeleteSnapshot
ec2:DeregisterImage
ec2:DescribeImages