CapacityProviderProps

class aws_cdk.aws_lambda.CapacityProviderProps(*, security_groups, subnets, architectures=None, capacity_provider_name=None, instance_type_filter=None, kms_key=None, log_group=None, max_v_cpu_count=None, operator_role=None, propagate_tags=None, scaling_options=None, system_log_level=None)

Bases: object

Properties for creating a Lambda capacity provider.

Parameters:
  • security_groups (Sequence[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.

  • subnets (Sequence[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.

  • architectures (Optional[Sequence[Architecture]]) – The instruction set architecture required for compute instances. Only one architecture can be specified per capacity provider. Default: - No architecture constraints specified

  • capacity_provider_name (Optional[str]) – 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.

  • instance_type_filter (Optional[InstanceTypeFilter]) – Configuration for filtering instance types that the capacity provider can use. Default: - No instance type filtering applied

  • kms_key (Optional[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

  • log_group (Optional[ILogGroupRef]) – The CloudWatch log group for capacity provider system logs. Default: - Service creates a default log group at /aws/lambda/capacity-provider/

  • max_v_cpu_count (Union[int, float, None]) – The maximum number of vCPUs that the capacity provider can scale up to. Default: - No maximum limit specified, service default is 400

  • operator_role (Optional[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

  • propagate_tags (Optional[PropagateTags]) – 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: - No tag propagation; tags are not propagated to managed resources.

  • scaling_options (Optional[ScalingOptions]) – The options for scaling a capacity provider, including scaling policies. Default: - The Auto option is applied by default

  • system_log_level (Optional[SystemLogLevel]) – The level of detail for capacity provider system logs. Default: - Service default applies (INFO)

ExampleMetadata:

infused

Example:

import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_logs as logs


vpc = ec2.Vpc(self, "MyVpc")
security_group = ec2.SecurityGroup(self, "SecurityGroup", vpc=vpc)

capacity_provider = lambda_.CapacityProvider(self, "MyCapacityProvider",
    subnets=vpc.private_subnets,
    security_groups=[security_group],
    log_group=logs.LogGroup(self, "CpLogs",
        log_group_name="/aws/lambda/capacity-provider/my-cp"
    ),
    system_log_level=lambda_.SystemLogLevel.DEBUG
)

Attributes

architectures

The instruction set architecture required for compute instances.

Only one architecture can be specified per capacity provider.

Default:
  • No architecture constraints specified

capacity_provider_name

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.

instance_type_filter

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

Default:
  • No instance type filtering applied

kms_key

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

log_group

The CloudWatch log group for capacity provider system logs.

Default:
  • Service creates a default log group at /aws/lambda/capacity-provider/

max_v_cpu_count

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

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

operator_role

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

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

propagate_tags

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:
  • No tag propagation; tags are not propagated to managed resources.

scaling_options

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

Default:
  • The Auto option is applied by default

security_groups

A list of security group IDs to associate with EC2 instances launched by the capacity provider.

Up to 5 security groups can be specified.

subnets

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.

system_log_level

The level of detail for capacity provider system logs.

Default:
  • Service default applies (INFO)