Sometimes after running the command “eb deploy” you can get the following error:

ERROR: ServiceError - You cannot have more than 1000 Application Versions. Either remove some Application Versions or request a limit increase.

This happens because there is a limit to the amount of application versions that can be stored by Elastic Beanstalk. The quick solution is to navigate to the Application Versions Page and delete a couple of versions, but this is only a temporary solution. Now Elastic Beanstalk allows us to easily set up a policy that removes application versions by age. Here is how to do it:

Go into AWS Elastic Beanstalk. Click on Applications.

Click on any of the environments of the application you want to configure the versions of.

Click on Upload and deploy

Click on the link Application Versions Page

Click on Settings

In this page you can configure the Application Versions.

In the screenshot above, we selected to enable the lifecycle policy, and to retain versions for 14 days only. It’s worth to note that an application version currently in the environment will never be deleted. You can also limit the amount of application versions and the older ones will be deleted as new ones get created. Click Save and you are good to go!

Leave a Reply

Your email address will not be published. Required fields are marked *