Deploying applications to the cloud is awesome; except when out of no where you hit a limit. I have hit this limit before and removed uploaded versions from S3 to resolve the issue; but as you can imagine that can be a bit more time consuming when your trying to push a hotfix.
The error
(venv)[mharris@mori app]$ ./deploy.py
Creating application version archive "app-eea5-160601_133149".
Uploading MyAPI/app-eea5-160601_133149.zip to S3. This may take a while.
Upload Complete.
ERROR: You cannot have more than 500 Application Versions. Either remove some Application Versions or request a limit increase.
(venv)[mharris@mori app]$ ./deploy.py
Creating application version archive "app-eea5-160601_133343".
Uploading MyAPI/app-eea5-160601_133343.zip to S3. This may take a while.
Upload Complete.
ERROR: You cannot have more than 500 Application Versions. Either remove some Application Versions or request a limit increase.
Automated solution
Luckily, Amazon has seemed to notice that this is an issue and provided a cli method to clean up older application versions.
(venv)[mharris@mori app]$ eb labs cleanup-versions --older-than 30
445 application versions will be deleted. Continue? (y/n): y
And now we can deploy without issue; yay!
(venv)[mharris@mori app]$ ./deploy.py
Creating application version archive "app-cf1b-160601_134401".
Uploading MyAPI/app-cf1b-160601_134401.zip to S3. This may take a while.
Upload Complete.
INFO: Environment update is starting.
INFO: Deleted log fragments for this environment.
INFO: Deploying new version to instance(s).
INFO: New application version was deployed to running EC2 instances.
INFO: Environment update completed successfully.
Some usage info which may help
usage: eb labs cleanup-versions [options...]
Cleans up old application versions.
positional arguments:
environment_name environment name
optional arguments:
-h, --help show this help message and exit
--debug toggle debug output
--quiet suppress all output
-v, --verbose toggle verbose output
--profile PROFILE use a specific profile from your credential file
-r REGION, --region REGION
use a specific region
--no-verify-ssl do not verify AWS SSL certificates
--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
Additional content from archive:
Deploying applications to the cloud is awesome; except when out of no where you hit a limit. I have hit this limit before and removed uploaded versions from S3 to resolve the issue; but as you can imagine that can be a bit more time consuming when your trying to push a hotfix.
The Error
(venv)[[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */ mydh-backend]$ ./deploy.py
Creating application version archive "app-eea5-160601_133149".
Uploading MyAPI/app-eea5-160601_133149.zip to S3. This may take a while.
Upload Complete.
ERROR: You cannot have more than 500 Application Versions. Either remove some Application Versions or request a limit increase.
(venv)[[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */ mydh-backend]$ ./deploy.py
Creating application version archive "app-eea5-160601_133343".
Uploading MyAPI/app-eea5-160601_133343.zip to S3. This may take a while.
Upload Complete.
ERROR: You cannot have more than 500 Application Versions. Either remove some Application Versions or request a limit increase.
Automated Solution
Luckily, Amazon has seemed to notice that this is an issue and provided a cli method to clean up older application versions.
(venv)[[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */ mydh-backend]$ eb labs cleanup-versions --older-than 30
445 application versions will be deleted. Continue? (y/n): y
And now we can deploy without issue; yay!
(venv)[[email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */ mydh-backend]$ ./deploy.py
Creating application version archive "app-cf1b-160601_134401".
Uploading MyAPI/app-cf1b-160601_134401.zip to S3. This may take a while.
Upload Complete.
INFO: Environment update is starting.
INFO: Deleted log fragments for this environment.
INFO: Deploying new version to instance(s).
INFO: New application version was deployed to running EC2 instances.
INFO: Environment update completed successfully.
Usage
usage: eb labs cleanup-versions [options...]
Cleans up old application versions.
positional arguments:
environment_name environment name
optional arguments:
-h, --help show this help message and exit
--debug toggle debug output
--quiet suppress all output
-v, --verbose toggle verbose output
--profile PROFILE use a specific profile from your credential file
-r REGION, --region REGION
use a specific region
--no-verify-ssl do not verify AWS SSL certificates
--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
Tell your friends...