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 ​

architecturesoptionalArchitecture[]architecturesoptionaltyping.List[Architecture]architecturesoptionalList<Architecture>ArchitecturesoptionalArchitecture[]Architecturesoptional*[]Architecture#
The instruction set architecture required for compute instances.

Default: No architecture constraints specified

Only one architecture can be specified per capacity provider.

capacityProviderNameoptionalstringcapacity_provider_nameoptionalstrcapacityProviderNameoptionalStringCapacityProviderNameoptionalstringCapacityProviderNameoptional*string#
The name of the capacity provider.

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

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

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

Default: No instance type filtering applied

kmsKeyoptionalIKeykms_keyoptionalIKeykmsKeyoptionalIKeyKmsKeyoptionalIKeyKmsKeyoptionalIKey#
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

logGroupoptionalILogGroupReflog_groupoptionalILogGroupReflogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRefLogGroupoptionalILogGroupRef#
The CloudWatch log group for capacity provider system logs.

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

maxVCpuCountoptionalnumbermax_v_cpu_countoptionalint | floatmaxVCpuCountoptionalNumberMaxVCpuCountoptionaldoubleMaxVCpuCountoptional*float64#
The maximum number of vCPUs that the capacity provider can scale up to.

Default: No maximum limit specified, service default is 400

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

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

propagateTagsoptionalPropagateTagspropagate_tagsoptionalPropagateTagspropagateTagsoptionalPropagateTagsPropagateTagsoptionalPropagateTagsPropagateTagsoptionalPropagateTags#
Configuration for tag propagation to managed resources (EC2 instances, ENIs, EBS volumes).

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

Use the static factory methods on PropagateTags to create:

  • PropagateTags.none() - Explicitly disable tag propagation
  • PropagateTags.explicit(tags) - Propagate specified tags
scalingOptionsoptionalScalingOptionsscaling_optionsoptionalScalingOptionsscalingOptionsoptionalScalingOptionsScalingOptionsoptionalScalingOptionsScalingOptionsoptionalScalingOptions#
The options for scaling a capacity provider, including scaling policies.

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.

systemLogLeveloptionalSystemLogLevelsystem_log_leveloptionalSystemLogLevelsystemLogLeveloptionalSystemLogLevelSystemLogLeveloptionalSystemLogLevelSystemLogLeveloptionalSystemLogLevel#
The level of detail for capacity provider system logs.

Default: Service default applies (INFO)