AWS预留实例限制(AWS Reserved Instances Limits)
我们目前在我们的AWS账户中运行少量m4.large和少量t2.medium&t2.small实例(EC2)。 我们计划在帐户中购买少量预留实例(RI)。 我参加了AWS博客 - 新增 - EC2预留实例的实例大小灵活性,并尝试启动了RI,但却遇到了一些问题。
请帮我澄清一下:
如果我购买1 t2.large的保留实例,我们可以运行它的等效t2。 相同成本的小或8 t2.micro实例(参考上面链接中的归一化因子)?
为了实现这种规范化实例大小的灵活性,选择哪种提供类 - “标准”或“可转换”或“要么应该没问题”?
实例规范化是否可以跨越不同的实例族? 即m4.large与t2.medium?
实例规范化是否会在之前和当前一代系列中发挥作用? 即m4.large与m3.medium?
我们有3个不同的AWS账户和一个合并账单,这个RI账单是否会在所有3个账户中正常化?
如果我购买任何级别的RI一年,如果我发现6个月后我的账户中没有这样的实例要求,那么我仍需要按月模式支付全部1年费用(如果我选择“No Upfront” “。获得一些钱(如果可能的话)的唯一方法是在”预留市场“中出售?
我们是否具有实例类型灵活性,仅适用于EC2或其他资源类型(RDS / Elasticache等)?
We're currently running few m4.large & few t2.medium & t2.small instances (EC2) in our AWS account. We're planning to buy few reserved instances (RI) in our accounts. I went to AWS Blog - New – Instance Size Flexibility for EC2 Reserved Instances and tried launching the RI but got stuck with a couple of things.
Please help me in clarifying:
If I buy a reserved instance of 1 t2.large, can we run its equivalent t2. small or 8 t2.micro instance at the same cost (referring to its normalization factor in link above)?
For this normalization on instance size flexibility to work, what offering class to be selected - "Standard" or "Convertible" or "Either should be fine"?
Will the instance normalization work across different families of instances? i.e. m4.large with t2.medium?
Will the instance normalization work across previous & current generation families? i.e. m4.large with m3.medium?
We have 3 different AWS accounts with a consolidated billing, will this RI billings will be normalized across all 3 accounts?
If I buy a RI of any class for 1 year and if I find that there is no such instance requirement in my account after 6 months, then still I need to pay the entire 1 year fees in monthly model (If I chose "No Upfront". The only way to get some money (if possible) would be to sell that in "Reserved Marketplace"?
Do we have instance type flexibility only work with EC2 or for other resource types (RDS/Elasticache etc.)?
原文:https://stackoverflow.com/questions/44177938
最满意答案
如上所述,您需要传递自定义比较功能进行排序。 像这样的东西
function s(a,b){ function normalize(str){ return str.concat(new Array(4-str.length).join(';')).replace(/[A-Z+-]/g, function($1){ return replacer[$1] ? replacer[$1] : $1; }); } var replacer = { 'A' : '1', 'B' : '2', 'C' : '3', '+' : ':', '-' : '<' }, ar = normalize(a), br = normalize(b); return ar > br ? 1 : ar < br ? -1 : 0; }
var array1 = ["AAA","BB","B+","AA+","CC","AA-","B","A","AA"]; function s(a,b){ function normalize(str){ return str.concat(new Array(4-str.length).join(';')).replace(/[A-Z+-]/g, function($1){ return replacer[$1] ? replacer[$1] : $1; }); } var replacer = { 'A' : '1', 'B' : '2', 'C' : '3', '+' : ':', '-' : '<' }, ar = normalize(a), br = normalize(b); return ar > br ? 1 : ar < br ? -1 : 0; } document.getElementById('before').innerHTML = 'unsorted: ' + array1.join(); array1.sort(s); document.getElementById('result').innerHTML = 'sorted: ' + array1.join();
<span id="before"></span><br> <span id="result"></span>
更新:更通用一点
function sorting(maxLen) { return function s(a, b) { function checkLength(str, maxlen) { if (str.length > maxlen) { throw new Error('string: "' + str + '" (' + str.length + ') too long, max len: ' + maxlen); } } function normalize(str, maxlen) { return str.concat(new Array(maxlen + 1 - str.length).join(';')).replace(/[A-Z+-]/g, function($1) { return replacer[$1] ? replacer[$1] : $1; }); } checkLength(a, maxLen); checkLength(b, maxLen); var replacer = { 'A': '1', 'B': '2', 'C': '3', '+': ':', '-': '<' }, ar = normalize(a, maxLen), br = normalize(b, maxLen); return ar > br ? 1 : ar < br ? -1 : 0; } }
并使用它的功能
array1.sort(sorting(array1.reduce(function(a,b){return Math.max(a, b.length);},0)))
var array1 = ["AAAA", "BB", "BBBB+", "AAA+", "CC", "AA-", "BBBB", "A", "AA"]; var array2 = ["AAAA", "BB", "BBBBB+", "AAA+", "CC", "AA-", "BBBB", "A", "AA"]; function sorting(maxLen) { return function s(a, b) { function checkLength(str, maxlen) { if (str.length > maxlen) { throw new Error('string: "' + str + '" (' + str.length + ') too long, max len: ' + maxlen); } } function normalize(str, maxlen) { return str.concat(new Array(maxlen + 1 - str.length).join(';')).replace(/[A-Z+-]/g, function($1) { return replacer[$1] ? replacer[$1] : $1; }); } checkLength(a, maxLen); checkLength(b, maxLen); var replacer = { 'A': '1', 'B': '2', 'C': '3', '+': ':', '-': '<' }, ar = normalize(a, maxLen), br = normalize(b, maxLen); return ar > br ? 1 : ar < br ? -1 : 0; } } function test(witherror, arr, maxlen) { document.getElementById(witherror + 'before').innerHTML = 'unsorted: ' + arr.join(); try { arr.sort(sorting(maxlen||arr.reduce(function(a,b){return Math.max(a, b.length);},0))); document.getElementById(witherror + 'result').innerHTML = 'sorted: ' + arr.join(); } catch (e) { document.getElementById(witherror + 'result').innerHTML = e; } } test('', array1,5); test('e', array2,5); test('a', array2);
<span>sample with error, string is too long</span> <br> <span id="ebefore"></span> <br> <span id="eresult"></span> <hr> <span>sample without error, maxlen = 5</span> <br> <span id="before"></span> <br> <span id="result"></span> <hr> <span>sample without error</span> <br> <span id="abefore"></span> <br> <span id="aresult"></span>
As say above you need pass custom compare function to sort. Something like this
function s(a,b){ function normalize(str){ return str.concat(new Array(4-str.length).join(';')).replace(/[A-Z+-]/g, function($1){ return replacer[$1] ? replacer[$1] : $1; }); } var replacer = { 'A' : '1', 'B' : '2', 'C' : '3', '+' : ':', '-' : '<' }, ar = normalize(a), br = normalize(b); return ar > br ? 1 : ar < br ? -1 : 0; }
var array1 = ["AAA","BB","B+","AA+","CC","AA-","B","A","AA"]; function s(a,b){ function normalize(str){ return str.concat(new Array(4-str.length).join(';')).replace(/[A-Z+-]/g, function($1){ return replacer[$1] ? replacer[$1] : $1; }); } var replacer = { 'A' : '1', 'B' : '2', 'C' : '3', '+' : ':', '-' : '<' }, ar = normalize(a), br = normalize(b); return ar > br ? 1 : ar < br ? -1 : 0; } document.getElementById('before').innerHTML = 'unsorted: ' + array1.join(); array1.sort(s); document.getElementById('result').innerHTML = 'sorted: ' + array1.join();
<span id="before"></span><br> <span id="result"></span>
UPDATE: a bit more generic
function sorting(maxLen) { return function s(a, b) { function checkLength(str, maxlen) { if (str.length > maxlen) { throw new Error('string: "' + str + '" (' + str.length + ') too long, max len: ' + maxlen); } } function normalize(str, maxlen) { return str.concat(new Array(maxlen + 1 - str.length).join(';')).replace(/[A-Z+-]/g, function($1) { return replacer[$1] ? replacer[$1] : $1; }); } checkLength(a, maxLen); checkLength(b, maxLen); var replacer = { 'A': '1', 'B': '2', 'C': '3', '+': ':', '-': '<' }, ar = normalize(a, maxLen), br = normalize(b, maxLen); return ar > br ? 1 : ar < br ? -1 : 0; } }
and use it function like
array1.sort(sorting(array1.reduce(function(a,b){return Math.max(a, b.length);},0)))
var array1 = ["AAAA", "BB", "BBBB+", "AAA+", "CC", "AA-", "BBBB", "A", "AA"]; var array2 = ["AAAA", "BB", "BBBBB+", "AAA+", "CC", "AA-", "BBBB", "A", "AA"]; function sorting(maxLen) { return function s(a, b) { function checkLength(str, maxlen) { if (str.length > maxlen) { throw new Error('string: "' + str + '" (' + str.length + ') too long, max len: ' + maxlen); } } function normalize(str, maxlen) { return str.concat(new Array(maxlen + 1 - str.length).join(';')).replace(/[A-Z+-]/g, function($1) { return replacer[$1] ? replacer[$1] : $1; }); } checkLength(a, maxLen); checkLength(b, maxLen); var replacer = { 'A': '1', 'B': '2', 'C': '3', '+': ':', '-': '<' }, ar = normalize(a, maxLen), br = normalize(b, maxLen); return ar > br ? 1 : ar < br ? -1 : 0; } } function test(witherror, arr, maxlen) { document.getElementById(witherror + 'before').innerHTML = 'unsorted: ' + arr.join(); try { arr.sort(sorting(maxlen||arr.reduce(function(a,b){return Math.max(a, b.length);},0))); document.getElementById(witherror + 'result').innerHTML = 'sorted: ' + arr.join(); } catch (e) { document.getElementById(witherror + 'result').innerHTML = e; } } test('', array1,5); test('e', array2,5); test('a', array2);
<span>sample with error, string is too long</span> <br> <span id="ebefore"></span> <br> <span id="eresult"></span> <hr> <span>sample without error, maxlen = 5</span> <br> <span id="before"></span> <br> <span id="result"></span> <hr> <span>sample without error</span> <br> <span id="abefore"></span> <br> <span id="aresult"></span>
相关问答
更多-
AngularJS / Javascript:使用运算符对字符串进行排序(AngularJS/Javascript: Sorting Strings With Operator)[2023-07-27]
如上所述,您需要传递自定义比较功能进行排序。 像这样的东西 function s(a,b){ function normalize(str){ return str.concat(new Array(4-str.length).join(';')).replace(/[A-Z+-]/g, function($1){ return replacer[$1] ? replacer[$1] : $1; }); } var replacer = { 'A' : '1 ... -
Javascript关系运算符用字符串显示奇怪的行为(Javascript Relational Operator Showing Weird Behavior with Strings)[2019-11-06]
这个: string1 == string2 == string3 手段: (string1 == string2) == string3 这就是说: true == string3 这不是true ,所以这是false 。 如果你想看看这三个字符串是否都是相同的,你需要 string1 == string2 && string2 == string3 编辑 - 这一切都与==运算符的行为中隐含的类型转换,以及表达式的语法和运算符优先级的规则有关。 ==运算符是左关联的 ,这意味着这个问题中的一串= ... -
从ECMAScript语言规范 11.3后缀表达式 句法 PostfixExpression: LeftHandSideExpression LeftHandSideExpression [这里没有LineTerminator] ++ LeftHandSideExpression [这里没有LineTerminator] - 11.3.1后缀增量运算符 制作PostfixExpression:LeftHandSideExpression [这里没有LineTerminator] ++的计算方法如下: 评估L ...
-
扩展字符串的运算符(Spread operator for strings)[2021-03-09]
正如我们下面看到的,你的例子实际上正在扩展到5个元素,其中2个是空间字符。 您还可以在下面看到,字符串上的扩展运算符似乎与使用.split('') 。 const x = "1 2 3"; console.log([...x]); console.log(x.split('')); As we can see below, your example is actually spreading to 5 elements, where 2 of them are space characters. Y ... -
需要AngularJS / Javascript三元运算符代码说明(AngularJS/Javascript ternary operator code explanation required)[2023-12-09]
这就是为什么三元组对可读性不利的原因。 该逗号与三元无关,因为它附加到变量声明。 所有这一切都是声明deferred的(未定义的)变量。 您可以使用逗号语法一次多个声明变量,如下所示: var x = 4, y = 7, z = Math.random(); This is why ternaries are bad for readability. That comma has nothing to do with the ternary, since it's attached to ... -
工作演示 $SchoolNames = Array(10003, "Southwestern College", "National University", "Western Governors University", "Southwestern College Admissions Center - Evaluations Dept"); $data = array( 0 => Array( 'STU_MANG_fname' => "Jennifer", 'S ...
-
当你设置hi = original_string你的hi变量只是一个指向同一个对象的新变量。 如果你看hi.object_id和original_string.object_id你会发现它们是一样的。 如果你想要一个可以在不影响original_string情况下操作的对象的克隆,你需要说一些类似hi = original_string.clone或hi = original_string.dup 。 When you set hi = original_string your hi variable is ...
-
对UTF-8字符串进行排序?(Sorting UTF-8 strings?)[2023-01-03]
如果您不想要词典排序(这是按字典顺序排序UTF-8编码的字符串会给您),那么您需要根据需要将UTF-8编码的字符串解码为UCS-2或UCS-4,并且应用您选择的合适的比较功能。 重申一点,UTF-8编码机制设计巧妙,如果您通过查看每个8位编码字节的数值进行排序,您将获得与首次将字符串解码为Unicode并进行比较时相同的结果每个代码点的数值。 更新:您更新的问题表明您需要比纯粹的词典排序更复杂的比较功能。 您将需要解码您的UTF-8字符串并比较解码的字符。 If you don't want a lexic ... -
是的, | 在正则表达式中是短路的。 例如, "The | is short circuiting, NOT!".match(/The \| is short circuiting(?:|, NOT!)/) 产生 ["The | is short circuiting"] 而 "The | is not short circuiting, NOT!".match(/The \| is not short circuiting(?:, NOT!|)/) 产生 ["The | is not short c ...
-
Javascript字符串是否有反向连接运算符?(Is there a reverse concatenation operator for Javascript strings?)[2023-10-04]
是否有相反方向的速记算子? 不,所有JavaScript 复合赋值运算符都将目标作为左侧操作数。 只需使用hello = ' world' + hello; 你有的陈述。 如果您正在重复执行此操作,请考虑使用数组作为缓冲区,您可以通过unshift方法将其添加到该缓冲区中。 Is there a shorthand operator for the opposite direction? No, all JavaScript compound assignment operators take the ta ...