Example #1
0
							return new Promise(function(resolve, reject) {
								var params = {
									AutoScalingGroupName: asg['AutoScalingGroupName'],
									DesiredCapacity: newDesiredCapacity,
									HonorCooldown: true
								};
								console.log(params);
								autoscaling.setDesiredCapacity(params, function(err, data) {
									if (err) {
										reject(err);
									} else {
										resolve("Increased DesiredCapacity " + asg["DesiredCapacity"] + " => " + newDesiredCapacity);
									}
								});
							});
Example #2
0
 function(asynccallback) {
     var params = {
         AutoScalingGroupName: ASG_NAME,
         /* required */
         DesiredCapacity: AUTO_SCALE_SIZE,
         /* required */
         HonorCooldown: true
     };
     autoscaling.setDesiredCapacity(params, function(err, data) {
         if (err)
             console.log(err, err.stack); // an error occurred
         else
             console.log(data); // successful response
         asynccallback(err);
     });
 },
function setAutoScalingGroupCapacity(stats, callback) {
    if (!config.externalGradingAutoScalingGroupName) return callback(null);
    if (!_.isInteger(stats.desired_instances)) return callback(null);
    if (stats.desired_instances < 1 || stats.desired_instances > 1e6) return callback(null);
    if (stats.desired_instances == stats.instance_count) return callback(null);

    const autoscaling = new AWS.AutoScaling();
    const params = {
        AutoScalingGroupName: config.externalGradingAutoScalingGroupName,
        DesiredCapacity: stats.desired_instances,
        HonorCooldown: false,
    };
    logger.verbose('setting AutoScalingGroup capacity', params);
    autoscaling.setDesiredCapacity(params, (err) => {
        if (ERR(err, callback)) return;
        callback(null);
    });
}