TooManyApplicationVersions Exception
在部署新应用程序版本(war)时,在AWS Elastic Beanstalk控制台上看到这条消息吗?上传war后才出现这条消息,非常烦人。
我想知道为什么会出现这种异常情况,以及应该采取哪些预防措施以避免这种情况发生?
TooManyApplicationVersions Exception
在部署新应用程序版本(war)时,在AWS Elastic Beanstalk控制台上看到这条消息吗?上传war后才出现这条消息,非常烦人。
我想知道为什么会出现这种异常情况,以及应该采取哪些预防措施以避免这种情况发生?
您看到的异常源自于达到了AWS Elastic Beanstalk的相应帐户限制,参见CreateApplicationVersion的错误部分:
- TooManyApplicationVersions - 调用方已超出与其帐户相关联的应用程序版本数的限制。
- TooManyApplications - 调用方已超出与其帐户相关联的应用程序数的限制。
当前限制概述在相应的常见问题中:
您最多可以创建25个应用程序和500个应用程序版本。默认情况下,您可以在所有应用程序中运行最多10个环境。如果您还在Elastic Beanstalk以外使用AWS,则可能不会[...]。如果您需要更多资源,请填写AWS Elastic Beanstalk请求表格,您的请求将得到及时评估。[我强调]
正如强调的那样,如果您确实需要许多应用程序版本可供重复使用,AWS提供了通常的升级选项,并允许您提交增加AWS Elastic Beanstalk限制请求。否则,您只需删除您将不再使用的旧版本,问题应相应消失。
祝好运!
$ eb labs cleanup-versions
默认情况下,这将清理最近10个版本和/或超过60天的版本。 添加--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
console.log('Deleting oldest application version.');
params = {};
local.waitFor(function(done) {
eb.describeApplicationVersions(params, function(err, data) {
if (err) {
console.error(err, err.stack);
local.abort('Could not retrieve the list of application version.');
} else {
// This is probably not needed as the list is already sorted but it is
// not written anywhere that this will always be the case
function compare(a,b) {
if (a.DateCreated > b.DateCreated)
return -1;
if (a.DateCreated < b.DateCreated)
return 1;
return 0;
}
var applicationsVersion = data['ApplicationVersions'].sort(compare),
oldestApplication = applicationsVersion[applicationsVersion.length - 1],
applicationName = oldestApplication['ApplicationName'],
versionLabel = oldestApplication['VersionLabel'];
params = {
ApplicationName: applicationName, /* required */
VersionLabel: versionLabel, /* required */
DeleteSourceBundle: false /* Do not delete source bundle from S3 */
};
eb.deleteApplicationVersion(params, function(err, data) {
if (err) {
console.error(err, err.stack);
local.abort('Could not delete the oldest application version. (' + versionLabel + ')')
} else {
console.log('Successfully deleted the oldest application version. (' + versionLabel + ')');
}
});
}
});
});
Elastic Beanstalk API(js)的文档:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ElasticBeanstalk.html
aws elasticbeanstalk describe-environments --output text --query 'Environments[*].[EnvironmentName]' | wc -l
版本数量
aws elasticbeanstalk describe-application-versions --output text --query 'ApplicationVersions[*].[ApplicationName]' | wc -l
默认值
>> 我还实现了自动回收,类似于update-application-resource-lifecycle
>> 我删除了几个环境/版本,但错误仍然存在
如果您到达了这一行,我唯一的解决方案就是手动删除环境及其版本。在我的情况下,该环境只有一个版本。