AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

CapacityProvider

A Lambda capacity provider that manages compute resources for Lambda functions.

Import

import { CapacityProvider } from 'aws-cdk-lib/aws-lambda';

Or use the module namespace:

import * as lambda from 'aws-cdk-lib/aws-lambda';
// lambda.CapacityProvider

Properties

Configuration passed to the constructor as CapacityProviderProps.

securityGroupsRequired
ISecurityGroup[]

A list of security group IDs to associate with EC2 instances launched by the capacity provider. Up to 5 security groups can be specified.

subnetsRequired
ISubnet[]

A list of subnets where the capacity provider can launch EC2 instances. At least one subnet must be specified, and up to 16 subnets are supported.

architecturesOptional
Architecture[]

The instruction set architecture required for compute instances. Only one architecture can be specified per capacity provider.

Default: - No architecture constraints specified

capacityProviderNameOptional
string

The name of the capacity provider. The name must be unique within the AWS account and region.

Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the capacity provider's name.

instanceTypeFilterOptional
InstanceTypeFilter

Configuration for filtering instance types that the capacity provider can use.

Default: - No instance type filtering applied

kmsKeyOptional
IKey

The AWS Key Management Service (KMS) key used to encrypt data associated with the capacity provider.

Default: - No KMS key specified, uses an AWS-managed key instead

maxVCpuCountOptional
number

The maximum number of vCPUs that the capacity provider can scale up to.

Default: - No maximum limit specified, service default is 400

operatorRoleOptional
IRole

The IAM role that the Lambda service assumes to manage the capacity provider.

Default: - A role will be generated containing the AWSLambdaManagedEC2ResourceOperator managed policy

scalingOptionsOptional
ScalingOptions

The options for scaling a capacity provider, including scaling policies.

Default: - The `Auto` option is applied by default

Get the AWS Lambda Cheat Sheet

Everything you need to know about AWS Lambda on one page. HD quality, print-friendly.

Download Free Infographic