Skip to content
v2.274.0

CapacityProviderProps Struct ​

Properties for creating a Lambda capacity provider.

Example ​

ts
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as logs from 'aws-cdk-lib/aws-logs';

const vpc = new ec2.Vpc(this, 'MyVpc');
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc });

const capacityProvider = new lambda.CapacityProvider(this, 'MyCapacityProvider', {
  subnets: vpc.privateSubnets,
  securityGroups: [securityGroup],
  logGroup: new logs.LogGroup(this, 'CpLogs', {
    logGroupName: '/aws/lambda/capacity-provider/my-cp',
  }),
  systemLogLevel: lambda.SystemLogLevel.DEBUG,
});

Properties ​

architecturesArchitecture[]architecturestyping.List[Architecture]architecturesList<Architecture>ArchitecturesArchitecture[]Architectures*[]Architecture= No architecture constraints spec…#
The instruction set architecture required for compute instances.

Only one architecture can be specified per capacity provider.

default

Default: No architecture constraints specified

capacityProviderNamestringcapacity_provider_namestrcapacityProviderNameStringCapacityProviderNamestringCapacityProviderName*string= AWS CloudFormation generates a u…#
The name of the capacity provider.

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

default

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

instanceTypeFilterInstanceTypeFilterinstance_type_filterInstanceTypeFilterinstanceTypeFilterInstanceTypeFilterInstanceTypeFilterInstanceTypeFilterInstanceTypeFilterInstanceTypeFilter= No instance type filtering appli…#
Configuration for filtering instance types that the capacity provider can use.
default

Default: No instance type filtering applied

kmsKeyIKeykms_keyIKeykmsKeyIKeyKmsKeyIKeyKmsKeyIKey= No KMS key specified, uses an AW…#
The AWS Key Management Service (KMS) key used to encrypt data associated with the capacity provider.
default

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

logGroupILogGroupReflog_groupILogGroupReflogGroupILogGroupRefLogGroupILogGroupRefLogGroupILogGroupRef= Service creates a default log gr…#
The CloudWatch log group for capacity provider system logs.
default

Default: Service creates a default log group at /aws/lambda/capacity-provider/<name>

maxVCpuCountnumbermax_v_cpu_countint | floatmaxVCpuCountNumberMaxVCpuCountdoubleMaxVCpuCount*float64= No maximum limit specified, serv…#
The maximum number of vCPUs that the capacity provider can scale up to.
default

Default: No maximum limit specified, service default is 400

operatorRoleIRoleoperator_roleIRoleoperatorRoleIRoleOperatorRoleIRoleOperatorRoleIRole= A role will be generated contain…#
The IAM role that the Lambda service assumes to manage the capacity provider.
default

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

propagateTagsPropagateTagspropagate_tagsPropagateTagspropagateTagsPropagateTagsPropagateTagsPropagateTagsPropagateTagsPropagateTags= No tag propagation; tags are not…#
Configuration for tag propagation to managed resources (EC2 instances, ENIs, EBS volumes).

Use the static factory methods on PropagateTags to create:

  • PropagateTags.none() - Explicitly disable tag propagation
  • PropagateTags.explicit(tags) - Propagate specified tags
default

Default: No tag propagation; tags are not propagated to managed resources.

scalingOptionsScalingOptionsscaling_optionsScalingOptionsscalingOptionsScalingOptionsScalingOptionsScalingOptionsScalingOptionsScalingOptions= The `Auto` option is applied by …#
The options for scaling a capacity provider, including scaling policies.
default

Default: The Auto option is applied by default

securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGrouprequired#
A list of security group IDs to associate with EC2 instances launched by the capacity provider.

Up to 5 security groups can be specified.

subnetsISubnet[]subnetstyping.List[ISubnet]subnetsList<ISubnet>SubnetsISubnet[]Subnets*[]ISubnetrequired#
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.

systemLogLevelSystemLogLevelsystem_log_levelSystemLogLevelsystemLogLevelSystemLogLevelSystemLogLevelSystemLogLevelSystemLogLevelSystemLogLevel= Service default applies (INFO)#
The level of detail for capacity provider system logs.