elastic-beanstalk


cannot deploy - ERROR: You cannot have more than 500 Application Versions


I get the following error when deploying to EB:
ERROR: You cannot have more than 500 Application Versions. Either
remove some Application Versions or request a limit increase.
I went manually and deleted some versions.
I don't want deploys to fail because of this limit.
Is there a way in Elastic Beanstalk to auto-evict unused versions?
A feature was recently added to eb cli (v3.3) to cleanup old versions
https://m.reddit.com/r/aws/comments/340ce0/whats_the_thinking_behind_beanstalks_versioning/
Copying command from reddit link
$ eb labs cleanup-versions --help
usage: eb labs cleanup-versions [options...]
Cleans up old application versions.
optional arguments:
--num-to-leave NUM number of versions to leave DEFAULT=10
--older-than DAYS delete only versions older than x days DEFAULT=60
--force don't prompt for confirmation
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
There's no built in way to do that, but the following ruby script performs just that. Simply schedule it using cron.
clearnup.rb:
application_name="myApp"
active_versions_shell_output = `aws elasticbeanstalk describe-environments --region=us-east-1 | grep git | awk '{gsub(/.*\:\ \"/,"",$0); print}'`
all_versions_shell_output = `aws elasticbeanstalk describe-applications --region=us-east-1 | grep git | awk '{gsub(/.*\ \"/,"",$0); print}'`
all_versions = all_versions_shell_output.split(/\n/).map{|x| x[0..57]}
active_versions = active_versions_shell_output.split(/\n/).map{|x| x[0..57]}
(all_versions - active_versions).each do |version_to_be_deleted|
puts "deleting #{version_to_be_deleted}"
`aws elasticbeanstalk delete-application-version --delete-source-bundle --application-name #{application_name} --version-label #{version_to_be_deleted}`
end
Now, they have added an admin UI page to delete all application versions:
Managing Application Versions

Related Links

Does anyone deploy meanio project to AWS Elasticbeanstalk?
AWS CodeDeploy?
Elastic Beanstalk randomly goes offline
How to enable parse server rest api
How to deploy config.json on elastic beanstalk
Error in AWS ElasticBeanStalk python 27 application that was running fine
Using elastic ip for amazon's ElasticBeanstalk instance
Creating custom scaling trigger for elastic beanstalk
Failing to deploy flask app on AWS Elastic Beanstalk environment
Elastic Beanstalk IAM developer permissions
Elastic beanstalk not using reserved instance
Updating AWS Elastic Bean has encountered a . How to resolve this?
How to automatically remove instances in EB whose status OutOfService is?
chmod configuration in elastic beanstalk
Where can I find elastic beanstalk “instance health for details”
Elastic Cache stuck in creating state

Categories

HOME
matlab
identityserver4
sharepoint-2013
compliance
auth0
servlets
robotframework
python-3.5
jsonschema
image-segmentation
delphi-xe7
android-dialer
wso2ei
librsvg
executable
marketplace
sparkpost
asp.net-mvc-5.2
installer
teraterm
aerospike
zap
jpos
cayley
pwm
similarity
sencha-touch-2
urlrewriter.net
vnc
pvs-studio
unsigned-integer
reformatting
asana-api
nest-thermostat
svgpanzoom
vue-router
tweenmax
webcenter
executorservice
docker-image
qweb
solid-principles
jupyter-irkernel
logicblox
easy-digital-downloads
automata-theory
quicksand
botkit
swift-package-manager
db2400
geneticsharp
sqlite-net
android-alertdialog
bootstrap-slider
business-logic
sqlfiddle
android-location
pager
activemodel
angularjs-filter
intrinsics
egl
xelement
par
openejb
mtp
hypervisor
user-registration
devenv
gem
react-rails
xerces
ehcache-bigmemory
generalization
theorem-proving
llvm-gcc
gcovr
json-web-token
applicationstate
computer-science-theory
express-jwt
windward
xidel
polarssl
webcal
virtual-earth
word-2010
dynamic-usercontrols
java-ee-5
pixelsense
oncreate
noindex
letter-spacing
httpcontext.cache
sharepoint-timer-job
maemo

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App