AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)
AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Configuring Application Version Lifecycle Settings

Each time you upload a new version of your application with the Elastic Beanstalk console or the EB CLI, Elastic Beanstalk creates an application version. If you don't delete versions that you no longer use, you will eventually reach the application version limit and be unable to create new versions of that application.

You can avoid hitting the limit by applying an application version lifecycle policy to your applications. A lifecycle policy tells Elastic Beanstalk to delete application versions that are old, or to delete application versions when the total number of versions for an application exceeds a specified number.

Elastic Beanstalk applies an application's lifecycle policy each time you create a new application version, and deletes up to 100 versions each time the lifecycle policy is applied. Elastic Beanstalk deletes old versions before creating the new version, and does not count the new version towards the maximum number of versions defined in the policy.

Elastic Beanstalk will not delete application versions that are currently being used by an environment, and will only delete up to 100 versions at a time. If more than 100 application versions meet the criteria for deletion, more are deleted the next time you create a version.

The application version limit applies across all applications in a region. If you have several applications, configure each application with a lifecycle policy appropriate to avoid reaching the limit. Elastic Beanstalk only applies the policy if the application version creation succeeds, so if you have already reached the limit, you must delete some versions manually prior to creating a new version.

By default, Elastic Beanstalk leaves the application version's source bundle in Amazon S3 to prevent loss of data. You can delete the source bundle to save space.

You can set the lifecycle settings through the Elastic Beanstalk CLI and APIs. See eb appversion, CreateApplication (using the ResourceLifecycleConfig parameter), and UpdateApplicationResourceLifecycle for details.