View a markdown version of this page

Manage lifecycle policies for Image Builder images - EC2 Image Builder

Manage lifecycle policies for Image Builder images

EC2 Image Builder lifecycle policies automate deprecation, disabling, and deletion of outdated images and their associated resources. Each pipeline build creates a new image version and distributes associated resources. Without lifecycle policies, earlier versions remain in your account until you delete them manually.

Lifecycle policies define rules that control when and how Image Builder retires outdated images. Associated resources include output images distributed to other AWS accounts, organizations, and organizational units (OUs). These resources can span multiple AWS Regions. You specify which lifecycle steps to include and when each step runs.

Enabled lifecycle policies run automatically once per day. Image Builder manages the execution schedule. For execution details, see How lifecycle policy execution works.

Benefits of automated lifecycle management

Automated lifecycle management:

  • Automates retirement of images and their associated resources across accounts and Regions.

  • Eliminates compliance risks from launching new instances with outdated images.

  • Maintains fresh image inventories by removing obsolete versions.

  • Reduces infrastructure costs by removing associated resources when you delete images.

Cost savings

There is no cost to use EC2 Image Builder to create custom AMI or container images. However, standard pricing applies for other services that are used in the process. Removing outdated images and associated resources reduces costs:

  • Reduces the number of images you need to patch by removing outdated versions.

  • Removes distributed AMIs and their associated snapshots when you delete AMI image resources, eliminating snapshot storage costs.

  • Deletes underlying resources when you delete container image resources, eliminating Amazon ECR storage costs and data transfer charges.

Note

Before you configure policy actions, verify that no downstream dependencies reference images the policy removes. Image Builder does not evaluate the impact on downstream dependencies such as Auto Scaling groups or launch templates.