I get the following error when deploying to EB:
ERROR: You cannot have more than 500 Application Versions. Either remove some Application Versions or re
At the time of writing this answer, eb labs cleanup-versions
does not work for me: it returned No application versions to delete
even when I had application versions.
As a workaround, I used this one-liner inspired from this answer (change the region and app name accordingly):
aws elasticbeanstalk describe-application-versions --output text --region=us-west-2 --query 'ApplicationVersions[*].[ApplicationName,VersionLabel,DateCreated]' | grep my-app-name | while read app ver date; do echo "deleting version $app $ver $date" ; aws elasticbeanstalk delete-application-version --region=us-west-2 --application-name $app --version-label $ver --delete-source-bundle; done