@Stability(value=Experimental) public static final class NodejsFunction.Builder extends Object
NodejsFunction.| Modifier and Type | Method and Description |
|---|---|
NodejsFunction.Builder |
allowAllOutbound(Boolean allowAllOutbound)
Whether to allow the Lambda to send all network traffic.
|
NodejsFunction |
build() |
NodejsFunction.Builder |
buildDir(String buildDir)
The build directory.
|
NodejsFunction.Builder |
cacheDir(String cacheDir)
The cache directory.
|
static NodejsFunction.Builder |
create(software.amazon.awscdk.core.Construct scope,
String id)
EXPERIMENTAL
|
NodejsFunction.Builder |
deadLetterQueue(software.amazon.awscdk.services.sqs.IQueue deadLetterQueue)
The SQS queue to use if DLQ is enabled.
|
NodejsFunction.Builder |
deadLetterQueueEnabled(Boolean deadLetterQueueEnabled)
Enabled DLQ.
|
NodejsFunction.Builder |
description(String description)
A description of the function.
|
NodejsFunction.Builder |
entry(String entry)
Path to the entry file (JavaScript or TypeScript).
|
NodejsFunction.Builder |
environment(Map<String,String> environment)
Key-value pairs that Lambda caches and makes available for your Lambda functions.
|
NodejsFunction.Builder |
events(List<software.amazon.awscdk.services.lambda.IEventSource> events)
Event sources for this function.
|
NodejsFunction.Builder |
functionName(String functionName)
A name for the function.
|
NodejsFunction.Builder |
handler(String handler)
The name of the exported handler in the entry file.
|
NodejsFunction.Builder |
initialPolicy(List<software.amazon.awscdk.services.iam.PolicyStatement> initialPolicy)
Initial policy statements to add to the created Lambda Role.
|
NodejsFunction.Builder |
layers(List<software.amazon.awscdk.services.lambda.ILayerVersion> layers)
A list of layers to add to the function's execution environment.
|
NodejsFunction.Builder |
logRetention(software.amazon.awscdk.services.logs.RetentionDays logRetention)
The number of days log events are kept in CloudWatch Logs.
|
NodejsFunction.Builder |
logRetentionRole(software.amazon.awscdk.services.iam.IRole logRetentionRole)
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
|
NodejsFunction.Builder |
maxEventAge(software.amazon.awscdk.core.Duration maxEventAge)
The maximum age of a request that Lambda sends to a function for processing.
|
NodejsFunction.Builder |
memorySize(Number memorySize)
The amount of memory, in MB, that is allocated to your Lambda function.
|
NodejsFunction.Builder |
minify(Boolean minify)
Whether to minify files when bundling.
|
NodejsFunction.Builder |
onFailure(software.amazon.awscdk.services.lambda.IDestination onFailure)
The destination for failed invocations.
|
NodejsFunction.Builder |
onSuccess(software.amazon.awscdk.services.lambda.IDestination onSuccess)
The destination for successful invocations.
|
NodejsFunction.Builder |
reservedConcurrentExecutions(Number reservedConcurrentExecutions)
The maximum of concurrent executions you want to reserve for the function.
|
NodejsFunction.Builder |
retryAttempts(Number retryAttempts)
The maximum number of times to retry when the function returns an error.
|
NodejsFunction.Builder |
role(software.amazon.awscdk.services.iam.IRole role)
Lambda execution role.
|
NodejsFunction.Builder |
runtime(software.amazon.awscdk.services.lambda.Runtime runtime)
The runtime environment.
|
NodejsFunction.Builder |
securityGroup(software.amazon.awscdk.services.ec2.ISecurityGroup securityGroup)
Deprecated.
- This property is deprecated, use securityGroups instead
|
NodejsFunction.Builder |
securityGroups(List<software.amazon.awscdk.services.ec2.ISecurityGroup> securityGroups)
The list of security groups to associate with the Lambda's network interfaces.
|
NodejsFunction.Builder |
sourceMaps(Boolean sourceMaps)
Whether to include source maps when bundling.
|
NodejsFunction.Builder |
timeout(software.amazon.awscdk.core.Duration timeout)
The function execution time (in seconds) after which Lambda terminates the function.
|
NodejsFunction.Builder |
tracing(software.amazon.awscdk.services.lambda.Tracing tracing)
Enable AWS X-Ray Tracing for Lambda Function.
|
NodejsFunction.Builder |
vpc(software.amazon.awscdk.services.ec2.IVpc vpc)
VPC network to place Lambda network interfaces.
|
NodejsFunction.Builder |
vpcSubnets(software.amazon.awscdk.services.ec2.SubnetSelection vpcSubnets)
Where to place the network interfaces within the VPC.
|
@Stability(value=Experimental) public static NodejsFunction.Builder create(software.amazon.awscdk.core.Construct scope, String id)
scope - This parameter is required.id - This parameter is required.NodejsFunction.Builder.@Stability(value=Stable) public NodejsFunction.Builder maxEventAge(software.amazon.awscdk.core.Duration maxEventAge)
Minimum: 60 seconds Maximum: 6 hours
Default: Duration.hours(6)
maxEventAge - The maximum age of a request that Lambda sends to a function for processing. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder onFailure(software.amazon.awscdk.services.lambda.IDestination onFailure)
Default: - no destination
onFailure - The destination for failed invocations. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder onSuccess(software.amazon.awscdk.services.lambda.IDestination onSuccess)
Default: - no destination
onSuccess - The destination for successful invocations. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder retryAttempts(Number retryAttempts)
Minimum: 0 Maximum: 2
Default: 2
retryAttempts - The maximum number of times to retry when the function returns an error. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder allowAllOutbound(Boolean allowAllOutbound)
If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets.
Default: true
allowAllOutbound - Whether to allow the Lambda to send all network traffic. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder deadLetterQueue(software.amazon.awscdk.services.sqs.IQueue deadLetterQueue)
Default: - SQS queue with 14 day retention period if `deadLetterQueueEnabled` is `true`
deadLetterQueue - The SQS queue to use if DLQ is enabled. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder deadLetterQueueEnabled(Boolean deadLetterQueueEnabled)
If deadLetterQueue is undefined,
an SQS queue with default options will be defined for your Function.
Default: - false unless `deadLetterQueue` is set, which implies DLQ is enabled.
deadLetterQueueEnabled - Enabled DLQ. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder description(String description)
Default: - No description.
description - A description of the function. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder environment(Map<String,String> environment)
Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Lambda function source code.
Default: - No environment variables.
environment - Key-value pairs that Lambda caches and makes available for your Lambda functions. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder events(List<software.amazon.awscdk.services.lambda.IEventSource> events)
You can also add event sources using addEventSource.
Default: - No event sources.
events - Event sources for this function. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder functionName(String functionName)
Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.
functionName - A name for the function. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder initialPolicy(List<software.amazon.awscdk.services.iam.PolicyStatement> initialPolicy)
You can call addToRolePolicy to the created lambda to add statements post creation.
Default: - No policy statements are added to the created Lambda role.
initialPolicy - Initial policy statements to add to the created Lambda Role. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder layers(List<software.amazon.awscdk.services.lambda.ILayerVersion> layers)
You can configure your Lambda function to pull in additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies that can be used by mulitple functions.
Default: - No layers.
layers - A list of layers to add to the function's execution environment. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder logRetention(software.amazon.awscdk.services.logs.RetentionDays logRetention)
When updating
this property, unsetting it doesn't remove the log retention policy. To
remove the retention policy, set the value to INFINITE.
Default: logs.RetentionDays.INFINITE
logRetention - The number of days log events are kept in CloudWatch Logs. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder logRetentionRole(software.amazon.awscdk.services.iam.IRole logRetentionRole)
Default: - A new role is created.
logRetentionRole - The IAM role for the Lambda function associated with the custom resource that sets the retention policy. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder memorySize(Number memorySize)
Lambda uses this value to proportionally allocate the amount of CPU power. For more information, see Resource Model in the AWS Lambda Developer Guide.
Default: 128
memorySize - The amount of memory, in MB, that is allocated to your Lambda function. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder reservedConcurrentExecutions(Number reservedConcurrentExecutions)
Default: - No specific limit - account limit.
reservedConcurrentExecutions - The maximum of concurrent executions you want to reserve for the function. This parameter is required.thishttps://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html@Stability(value=Stable) public NodejsFunction.Builder role(software.amazon.awscdk.services.iam.IRole role)
This is the role that will be assumed by the function upon execution. It controls the permissions that the function will have. The Role must be assumable by the 'lambda.amazonaws.com' service principal.
Default: - A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling `addToRolePolicy`.
role - Lambda execution role. This parameter is required.this@Stability(value=Deprecated) @Deprecated public NodejsFunction.Builder securityGroup(software.amazon.awscdk.services.ec2.ISecurityGroup securityGroup)
Only used if 'vpc' is supplied.
Use securityGroups property instead. Function constructor will throw an error if both are specified.
Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroups prop, a dedicated security group will be created for this function.
securityGroup - What security group to associate with the Lambda's network interfaces. This property is being deprecated, consider using securityGroups instead. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder securityGroups(List<software.amazon.awscdk.services.ec2.ISecurityGroup> securityGroups)
Only used if 'vpc' is supplied.
Default: - If the function is placed within a VPC and a security group is not specified, either by this or securityGroup prop, a dedicated security group will be created for this function.
securityGroups - The list of security groups to associate with the Lambda's network interfaces. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder timeout(software.amazon.awscdk.core.Duration timeout)
Because the execution time affects cost, set this value based on the function's expected execution time.
Default: Duration.seconds(3)
timeout - The function execution time (in seconds) after which Lambda terminates the function. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder tracing(software.amazon.awscdk.services.lambda.Tracing tracing)
Default: Tracing.Disabled
tracing - Enable AWS X-Ray Tracing for Lambda Function. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder vpc(software.amazon.awscdk.services.ec2.IVpc vpc)
Specify this if the Lambda function needs to access resources in a VPC.
Default: - Function is not placed within a VPC.
vpc - VPC network to place Lambda network interfaces. This parameter is required.this@Stability(value=Stable) public NodejsFunction.Builder vpcSubnets(software.amazon.awscdk.services.ec2.SubnetSelection vpcSubnets)
Only used if 'vpc' is supplied. Note: internet access for Lambdas requires a NAT gateway, so picking Public subnets is not allowed.
Default: - Private subnets.
vpcSubnets - Where to place the network interfaces within the VPC. This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder buildDir(String buildDir)
Default: - `.build` in the entry file directory
EXPERIMENTAL
buildDir - The build directory. This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder cacheDir(String cacheDir)
Parcel uses a filesystem cache for fast rebuilds.
Default: - `.cache` in the root directory
EXPERIMENTAL
cacheDir - The cache directory. This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder entry(String entry)
Default: - Derived from the name of the defining file and the construct's id. If the `NodejsFunction` is defined in `stack.ts` with `my-handler` as id (`new NodejsFunction(this, 'my-handler')`), the construct will look at `stack.my-handler.ts` and `stack.my-handler.js`.
EXPERIMENTAL
entry - Path to the entry file (JavaScript or TypeScript). This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder handler(String handler)
Default: handler
EXPERIMENTAL
handler - The name of the exported handler in the entry file. This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder minify(Boolean minify)
Default: false
EXPERIMENTAL
minify - Whether to minify files when bundling. This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder runtime(software.amazon.awscdk.services.lambda.Runtime runtime)
Only runtimes of the Node.js family are supported.
Default: - `NODEJS_12_X` if `process.versions.node` >= '12.0.0', `NODEJS_10_X` otherwise.
EXPERIMENTAL
runtime - The runtime environment. This parameter is required.this@Stability(value=Experimental) public NodejsFunction.Builder sourceMaps(Boolean sourceMaps)
Default: false
EXPERIMENTAL
sourceMaps - Whether to include source maps when bundling. This parameter is required.this@Stability(value=Experimental) public NodejsFunction build()
Copyright © 2024. All rights reserved.