CapacityProviderProps

class aws_cdk.aws_lambda.CapacityProviderProps(*, security_groups, subnets, architectures=None, capacity_provider_name=None, instance_type_filter=None, kms_key=None, max_v_cpu_count=None, operator_role=None, scaling_options=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

  • 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

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

ExampleMetadata:

infused

Example:

import aws_cdk.aws_ec2 as ec2


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],
    scaling_options=lambda_.ScalingOptions.manual([
        lambda_.TargetTrackingScalingPolicy.cpu_utilization(70)
    ])
)

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

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

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.