Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-cdk/aws-applicationautoscaling

Package Overview
Dependencies
Maintainers
3
Versions
288
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-cdk/aws-applicationautoscaling

The CDK Construct Library for AWS::ApplicationAutoScaling

  • 0.8.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
118K
decreased by-2.52%
Maintainers
3
Weekly downloads
 
Created

What is @aws-cdk/aws-applicationautoscaling?

@aws-cdk/aws-applicationautoscaling is an AWS CDK library that allows you to configure application auto-scaling for various AWS resources. It provides constructs for defining scaling policies and targets, enabling you to automatically adjust capacity based on demand.

What are @aws-cdk/aws-applicationautoscaling's main functionalities?

Auto-scaling for DynamoDB

This feature allows you to set up auto-scaling for a DynamoDB table. The code sample demonstrates how to create a DynamoDB table and configure auto-scaling for its read capacity based on utilization.

const app = new cdk.App();
const stack = new cdk.Stack(app, 'AutoScalingStack');

const table = new dynamodb.Table(stack, 'MyTable', {
  partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING },
  billingMode: dynamodb.BillingMode.PROVISIONED,
});

const readScaling = table.autoScaleReadCapacity({
  minCapacity: 1,
  maxCapacity: 10,
});

readScaling.scaleOnUtilization({
  targetUtilizationPercent: 75,
});

Auto-scaling for ECS Services

This feature allows you to set up auto-scaling for ECS services. The code sample demonstrates how to create an ECS Fargate service and configure auto-scaling based on CPU utilization.

const app = new cdk.App();
const stack = new cdk.Stack(app, 'AutoScalingStack');

const cluster = new ecs.Cluster(stack, 'Cluster', {
  vpc,
});

const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef');

const container = taskDefinition.addContainer('WebContainer', {
  image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
  memoryLimitMiB: 512,
});

const service = new ecs.FargateService(stack, 'Service', {
  cluster,
  taskDefinition,
});

const scaling = service.autoScaleTaskCount({
  minCapacity: 1,
  maxCapacity: 10,
});

scaling.scaleOnCpuUtilization('CpuScaling', {
  targetUtilizationPercent: 50,
});

Auto-scaling for Lambda Functions

This feature allows you to set up auto-scaling for Lambda functions. The code sample demonstrates how to create a Lambda function and configure auto-scaling based on utilization.

const app = new cdk.App();
const stack = new cdk.Stack(app, 'AutoScalingStack');

const fn = new lambda.Function(stack, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_14_X,
  handler: 'index.handler',
  code: lambda.Code.fromAsset('lambda'),
});

const alias = new lambda.Alias(stack, 'Alias', {
  aliasName: 'prod',
  version: fn.currentVersion,
});

const scaling = alias.addAutoScaling({
  minCapacity: 1,
  maxCapacity: 10,
});

scaling.scaleOnUtilization({
  utilizationTarget: 0.75,
});

Other packages similar to @aws-cdk/aws-applicationautoscaling

Keywords

FAQs

Package last updated on 31 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc