Skip to content
v2.277.0

CapacityProviderFunctionOptions Struct ​

Options for creating a function associated with a capacity provider.

Example ​

ts
declare const capacityProvider: lambda.CapacityProvider;

const fn = new lambda.Function(this, 'MyFunction', {
  // Runtime must be equal to or newer than NODEJS_LATEST
  runtime: lambda.Runtime.NODEJS_LATEST,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});

// Associate the function with the capacity provider
capacityProvider.addFunction(fn, {
  perExecutionEnvironmentMaxConcurrency: 10,
  executionEnvironmentMemoryGiBPerVCpu: 4,
});
python
# capacity_provider: lambda.CapacityProvider


fn = lambda_.Function(self, "MyFunction",
    # Runtime must be equal to or newer than NODEJS_LATEST
    runtime=lambda_.Runtime.NODEJS_LATEST,
    handler="index.handler",
    code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler"))
)

# Associate the function with the capacity provider
capacity_provider.add_function(fn,
    per_execution_environment_max_concurrency=10,
    execution_environment_memory_gi_b_per_v_cpu=4
)
java
CapacityProvider capacityProvider;


Function fn = Function.Builder.create(this, "MyFunction")
        // Runtime must be equal to or newer than NODEJS_LATEST
        .runtime(Runtime.NODEJS_LATEST)
        .handler("index.handler")
        .code(Code.fromAsset(join(__dirname, "lambda-handler")))
        .build();

// Associate the function with the capacity provider
capacityProvider.addFunction(fn, CapacityProviderFunctionOptions.builder()
        .perExecutionEnvironmentMaxConcurrency(10)
        .executionEnvironmentMemoryGiBPerVCpu(4)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
CapacityProvider capacityProvider;


var fn = new Function(this, "MyFunction", new FunctionProps {
    // Runtime must be equal to or newer than NODEJS_LATEST
    Runtime = Runtime.NODEJS_LATEST,
    Handler = "index.handler",
    Code = Code.FromAsset(Join(__dirname, "lambda-handler"))
});

// Associate the function with the capacity provider
capacityProvider.AddFunction(fn, new CapacityProviderFunctionOptions {
    PerExecutionEnvironmentMaxConcurrency = 10,
    ExecutionEnvironmentMemoryGiBPerVCpu = 4
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var capacityProvider CapacityProvider


fn := lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
	// Runtime must be equal to or newer than NODEJS_LATEST
	Runtime: lambda.Runtime_NODEJS_LATEST(),
	Handler: jsii.String("index.handler"),
	Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("lambda-handler"))),
})

// Associate the function with the capacity provider
capacityProvider.AddFunction(fn, &CapacityProviderFunctionOptions{
	PerExecutionEnvironmentMaxConcurrency: jsii.Number(10),
	ExecutionEnvironmentMemoryGiBPerVCpu: jsii.Number(4),
})

Properties ​

executionEnvironmentMemoryGiBPerVCpuoptionalnumberexecution_environment_memory_gi_b_per_v_cpuoptionalint | floatexecutionEnvironmentMemoryGiBPerVCpuoptionalNumberExecutionEnvironmentMemoryGiBPerVCpuoptionaldoubleExecutionEnvironmentMemoryGiBPerVCpuoptional*float64 = 2.0 #
Specifies the execution environment memory per VCPU, in GiB.
latestPublishedScalingConfigoptionalLatestPublishedScalingConfiglatest_published_scaling_configoptionalLatestPublishedScalingConfiglatestPublishedScalingConfigoptionalLatestPublishedScalingConfigLatestPublishedScalingConfigoptionalLatestPublishedScalingConfigLatestPublishedScalingConfigoptionalLatestPublishedScalingConfig #
The scaling options that are applied to the $LATEST.PUBLISHED version.

Default: No scaling limitations are applied to the $LATEST.PUBLISHED version.

perExecutionEnvironmentMaxConcurrencyoptionalnumberper_execution_environment_max_concurrencyoptionalint | floatperExecutionEnvironmentMaxConcurrencyoptionalNumberPerExecutionEnvironmentMaxConcurrencyoptionaldoublePerExecutionEnvironmentMaxConcurrencyoptional*float64 #
Specifies the maximum number of concurrent invokes a single execution environment can handle.

Default: Maximum is set to 10

publishToLatestPublishedoptionalbooleanpublish_to_latest_publishedoptionalboolpublishToLatestPublishedoptionalBooleanPublishToLatestPublishedoptionalboolPublishToLatestPublishedoptional*bool = True #
A boolean determining whether or not to automatically publish to the $LATEST.PUBLISHED version.