Class CapacityProvider

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.lambda.CapacityProvider
All Implemented Interfaces:
IEnvironmentAware, IResource, ICapacityProvider, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)", date="2025-12-12T17:54:16.191Z") @Stability(Stable) public class CapacityProvider extends Resource implements ICapacityProvider
A Lambda capacity provider that manages compute resources for Lambda functions.

Example:

 import software.amazon.awscdk.services.ec2.*;
 Vpc vpc = new Vpc(this, "MyVpc");
 SecurityGroup securityGroup = SecurityGroup.Builder.create(this, "SecurityGroup").vpc(vpc).build();
 CapacityProvider capacityProvider = CapacityProvider.Builder.create(this, "MyCapacityProvider")
         .subnets(vpc.getPrivateSubnets())
         .securityGroups(List.of(securityGroup))
         .scalingOptions(ScalingOptions.manual(List.of(TargetTrackingScalingPolicy.cpuUtilization(70))))
         .build();
 
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Stable) public static final String PROPERTY_INJECTION_ID
      Uniquely identifies this class.
  • Constructor Details

    • CapacityProvider

      protected CapacityProvider(software.amazon.jsii.JsiiObjectRef objRef)
    • CapacityProvider

      protected CapacityProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CapacityProvider

      @Stability(Stable) public CapacityProvider(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CapacityProviderProps props)
      Creates a new Lambda capacity provider.

      Parameters:
      scope - The parent construct. This parameter is required.
      id - The construct ID. This parameter is required.
      props - The capacity provider properties. This parameter is required.
  • Method Details

    • fromCapacityProviderArn

      @Stability(Stable) @NotNull public static ICapacityProvider fromCapacityProviderArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String capacityProviderArn)
      Import an existing capacity provider by ARN.

      Parameters:
      scope - The parent construct. This parameter is required.
      id - The construct ID. This parameter is required.
      capacityProviderArn - The ARN of the capacity provider to import. This parameter is required.
    • fromCapacityProviderAttributes

      @Stability(Stable) @NotNull public static ICapacityProvider fromCapacityProviderAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CapacityProviderAttributes attrs)
      Import an existing capacity provider using its attributes.

      Parameters:
      scope - The parent construct. This parameter is required.
      id - The construct ID. This parameter is required.
      attrs - The capacity provider attributes. This parameter is required.
    • fromCapacityProviderName

      @Stability(Stable) @NotNull public static ICapacityProvider fromCapacityProviderName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String capacityProviderName)
      Import an existing capacity provider by name.

      Parameters:
      scope - The parent construct. This parameter is required.
      id - The construct ID. This parameter is required.
      capacityProviderName - The name of the capacity provider to import. This parameter is required.
    • addFunction

      @Stability(Stable) public void addFunction(@NotNull IFunction func, @Nullable CapacityProviderFunctionOptions options)
      Configures a Lambda function to use this capacity provider.

      Parameters:
      func - The Lambda function to configure. This parameter is required.
      options - Optional configuration for the function's capacity provider settings.
    • addFunction

      @Stability(Stable) public void addFunction(@NotNull IFunction func)
      Configures a Lambda function to use this capacity provider.

      Parameters:
      func - The Lambda function to configure. This parameter is required.
    • getCapacityProviderArn

      @Stability(Stable) @NotNull public String getCapacityProviderArn()
      The Amazon Resource Name (ARN) of the capacity provider.
      Specified by:
      getCapacityProviderArn in interface ICapacityProvider
    • getCapacityProviderName

      @Stability(Stable) @NotNull public String getCapacityProviderName()
      The name of the capacity provider.
      Specified by:
      getCapacityProviderName in interface ICapacityProvider