You can deprecate an AMI to indicate that it is out of date and should not be used. You can also specify a future deprecation date for an AMI, indicating when the AMI will be out of date. For example, you might deprecate an AMI that is no longer actively maintained, or you might deprecate an AMI that has been superseded by a newer version. By default, deprecated AMIs do not appear in AMI listings, preventing new users from using out-of-date AMIs. However, existing users and launch services, such as launch templates and Auto Scaling groups, can continue to use a deprecated AMI by specifying its ID. To delete the AMI so that users and services cannot use it, you must deregister it.
After an AMI is deprecated:
-
For AMI users, the deprecated AMI does not appear in DescribeImages API calls unless you specify its ID or specify that deprecated AMIs must appear. AMI owners continue to see deprecated AMIs in DescribeImages API calls.
-
For AMI users, the deprecated AMI is not available to select via the EC2 console. For example, a deprecated AMI does not appear in the AMI catalog in the launch instance wizard. AMI owners continue to see deprecated AMIs in the EC2 console.
-
For AMI users, if you know the ID of a deprecated AMI, you can continue to launch instances using the deprecated AMI by using the API, CLI, or the SDKs.
-
Launch services, such as launch templates and Auto Scaling groups, can continue to reference deprecated AMIs.
-
EC2 instances that were launched using an AMI that is subsequently deprecated are not affected, and can be stopped, started, and rebooted.
You can deprecate both private and public AMIs.
You can also create Amazon Data Lifecycle Manager EBS-backed AMI policies to automate the deprecation of EBS-backed AMIs. For more information, see Automate AMI lifecycles.
Note
By default, the deprecation date of all public AMIs is set to two years from the AMI creation date. You can set the deprecation date to earlier than two years. To cancel the deprecation date, or to move the deprecation to a later date, you must make the AMI private by only sharing it with specific AWS accounts.
Costs
When you deprecate an AMI, the AMI is not deleted. The AMI owner continues to pay for the AMI's snapshots. To stop paying for the snapshots, the AMI owner must delete the AMI by deregistering it.
Limitations
-
To deprecate an AMI, you must be the owner of the AMI.
Deprecate an AMI
You can deprecate an AMI on a specific date and time. You must be the AMI owner to perform this procedure.
To deprecate an AMI on a specific date
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the left navigator, choose AMIs.
-
From the filter bar, choose Owned by me.
-
Select the AMI, and then choose Actions, Manage AMI Deprecation. You can select multiple AMIs to set the same deprecation date of several AMIs at once.
-
Select the Enable checkbox, and then enter the deprecation date and time.
The upper limit for the deprecation date is 10 years from now, except for public AMIs, where the upper limit is 2 years from the creation date. You can’t specify a date in the past.
-
Choose Save.
Check when an AMI was last used
LastLaunchedTime
is a timestamp that indicates when your AMI was last used to
launch an instance. AMIs that have not been used recently to launch an instance
might be good candidates for deprecation or deregistering.
Note
-
When an AMI is used to launch an instance, there is a 24-hour delay before that usage is reported.
-
lastLaunchedTime
data is available starting April 2017.
To view the last launched time of an AMI
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the left navigator, choose AMIs.
-
From the filter bar, choose Owned by me.
-
Select the AMI, and then check the Last launched time field (if you selected the checkbox next to the AMI, it's located on the Details tab). The field shows the date and time when the AMI was last used to launch an instance.
Describe deprecated AMIs
You can view the deprecation date and time of an AMI, and filter all the AMIs by deprecation date. You can also use the AWS CLI to describe all the AMIs that have been deprecated, where the deprecation date is in the past.
To view the deprecation date of an AMI
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the left navigator, choose AMIs, and then select the AMI.
-
Check the Deprecation time field (if you selected the checkbox next to the AMI, it's located on the Details tab). The field shows the deprecation date and time of the AMI. If the field is empty, the AMI is not deprecated.
To filter AMIs by deprecation date
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the left navigator, choose AMIs.
-
From the filter bar, choose Owned by me or Private images (private images include AMIs that are shared with you as well as owned by you).
-
In the Search bar, enter
Deprecation time
(as you enter the letters, the Deprecation time filter appears), and then choose an operator and a date and time.
Cancel AMI deprecation
You can cancel the deprecation of an AMI, which removes the date and time from the
Deprecation time field (console) or the
DeprecationTime
field from the describe-images
To cancel the deprecation of an AMI
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the left navigator, choose AMIs.
-
From the filter bar, choose Owned by me.
-
Select the AMI, and then choose Actions, Manage AMI Deprecation. You can select multiple AMIs to cancel the deprecation of several AMIs at once.
-
Clear the Enable checkbox, and then choose Save.