How to use the @aws-cdk/aws-applicationautoscaling.PredefinedMetric function in @aws-cdk/aws-applicationautoscaling

To help you get started, we’ve selected a few @aws-cdk/aws-applicationautoscaling examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / aws-dynamodb / lib / scalable-table-attribute.ts View on Github external
public scaleOnUtilization(props: UtilizationScalingProps) {
    if (props.targetUtilizationPercent < 10 || props.targetUtilizationPercent > 90) {
      // tslint:disable-next-line:max-line-length
      throw new RangeError(`targetUtilizationPercent for DynamoDB scaling must be between 10 and 90 percent, got: ${props.targetUtilizationPercent}`);
    }
    const predefinedMetric = this.props.dimension.indexOf('ReadCapacity') === -1
        ? appscaling.PredefinedMetric.DYANMODB_WRITE_CAPACITY_UTILIZATION
        : appscaling.PredefinedMetric.DYNAMODB_READ_CAPACITY_UTILIZATION;

    super.doScaleToTrackMetric('Tracking', {
      policyName: props.policyName,
      disableScaleIn: props.disableScaleIn,
      scaleInCooldown: props.scaleInCooldown,
      scaleOutCooldown: props.scaleOutCooldown,
      targetValue: props.targetUtilizationPercent,
      predefinedMetric,
    });
  }
}
github aws / aws-cdk / packages / @aws-cdk / aws-ecs / lib / base / scalable-task-count.ts View on Github external
public scaleOnCpuUtilization(id: string, props: CpuUtilizationScalingProps) {
    return super.doScaleToTrackMetric(id, {
      predefinedMetric: appscaling.PredefinedMetric.ECS_SERVICE_AVERAGE_CPU_UTILIZATION,
      policyName: props.policyName,
      disableScaleIn: props.disableScaleIn,
      targetValue: props.targetUtilizationPercent,
      scaleInCooldown: props.scaleInCooldown,
      scaleOutCooldown: props.scaleOutCooldown
    });
  }

@aws-cdk/aws-applicationautoscaling

The CDK Construct Library for AWS::ApplicationAutoScaling

Apache-2.0
Latest version published 10 months ago

Package Health Score

70 / 100
Full package analysis