Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FunctionOptions

Defaults for all Lambda functions in the stack.

Hierarchy

Index

Properties

Optional Readonly allowAllOutbound

allowAllOutbound?: boolean

Whether to allow the Lambda to send all network traffic.

If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets.

default

true

stability

stable

Optional Readonly allowPublicSubnet

allowPublicSubnet?: boolean

Lambda Functions in a public subnet can NOT access the internet.

Use this property to acknowledge this limitation and still place the function in a public subnet.

default

false

see

https://stackoverflow.com/questions/52992085/why-cant-an-aws-lambda-function-inside-a-public-subnet-in-a-vpc-connect-to-the/52994841#52994841

stability

stable

Optional autoScalingOptions

autoScalingOptions?: AutoScalingOptions

Autoscaling and provisioned concurrency settings.

Optional Readonly awsSdkConnectionReuse

awsSdkConnectionReuse?: boolean

Whether to automatically reuse TCP connections when working with the AWS SDK for JavaScript.

This sets the AWS_NODEJS_CONNECTION_REUSE_ENABLED environment variable to 1.

default

true

see

https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html

stability

stable

Optional Readonly bundling

bundling?: BundlingOptions

Bundling options.

default
  • use default bundling options: no minify, no sourcemap, all modules are bundled.
stability

stable

Optional Readonly codeSigningConfig

codeSigningConfig?: ICodeSigningConfig

Code signing config associated with this function.

default
  • Not Sign the Code
stability

stable

Optional Readonly currentVersionOptions

currentVersionOptions?: VersionOptions

Options for the lambda.Version resource automatically created by the fn.currentVersion method.

default
  • default options as described in VersionOptions
stability

stable

Optional Readonly deadLetterQueue

deadLetterQueue?: IQueue

The SQS queue to use if DLQ is enabled.

default
  • SQS queue with 14 day retention period if deadLetterQueueEnabled is true
stability

stable

Optional Readonly deadLetterQueueEnabled

deadLetterQueueEnabled?: boolean

Enabled DLQ.

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.
stability

stable

Optional Readonly depsLockFilePath

depsLockFilePath?: string

The path to the dependencies lock file (yarn.lock or package-lock.json).

This will be used as the source for the volume mounted in the Docker container.

Modules specified in nodeModules will be installed using the right installer (npm or yarn) along with this lock file.

default
  • the path is found by walking up parent directories searching for a yarn.lock or package-lock.json file
stability

stable

Optional Readonly description

description?: string

A description of the function.

default
  • No description.
stability

stable

Optional Readonly entry

entry?: string

Path to the entry file (JavaScript or TypeScript).

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.
stability

stable

Optional Readonly environment

environment?: {}

Key-value pairs that Lambda caches and makes available for your Lambda functions.

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.
stability

stable

Type declaration

  • [key: string]: string

Optional Readonly environmentEncryption

environmentEncryption?: IKey

The AWS KMS key that's used to encrypt your function's environment variables.

default
  • AWS Lambda creates and uses an AWS managed customer master key (CMK).
stability

stable

Optional Readonly events

events?: IEventSource[]

Event sources for this function.

You can also add event sources using addEventSource.

default
  • No event sources.
stability

stable

Optional Readonly filesystem

filesystem?: FileSystem

The filesystem configuration for the lambda function.

default
  • will not mount any filesystem
stability

stable

Optional Readonly functionName

functionName?: string

A name for the function.

default
  • AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.
stability

stable

Optional grantDatabaseAccess

grantDatabaseAccess?: boolean

Optional Readonly handler

handler?: string

The name of the exported handler in the entry file.

default

handler

stability

stable

Optional Readonly initialPolicy

initialPolicy?: PolicyStatement[]

Initial policy statements to add to the created Lambda Role.

You can call addToRolePolicy to the created lambda to add statements post creation.

default
  • No policy statements are added to the created Lambda role.
stability

stable

Optional Readonly insightsVersion

insightsVersion?: LambdaInsightsVersion

Specify the version of CloudWatch Lambda insights to use for monitoring.

default
  • No Lambda Insights
see

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights.html

stability

stable

Optional layerArns

layerArns?: string[]

Optional Readonly layers

layers?: ILayerVersion[]

A list of layers to add to the function's execution environment.

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 multiple functions.

default
  • No layers.
stability

stable

Optional Readonly logRetention

logRetention?: RetentionDays

The number of days log events are kept in CloudWatch Logs.

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

stability

stable

Optional Readonly logRetentionRetryOptions

logRetentionRetryOptions?: LogRetentionRetryOptions

When log retention is specified, a custom resource attempts to create the CloudWatch log group.

These options control the retry policy when interacting with CloudWatch APIs.

default
  • Default AWS SDK retry options.
stability

stable

Optional Readonly logRetentionRole

logRetentionRole?: IRole

The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

default
  • A new role is created.
stability

stable

Optional Readonly maxEventAge

maxEventAge?: Duration

The maximum age of a request that Lambda sends to a function for processing.

Minimum: 60 seconds Maximum: 6 hours

default

Duration.hours(6)

stability

stable

Optional Readonly memorySize

memorySize?: number

The amount of memory, in MB, that is allocated to your Lambda function.

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

stability

stable

Optional metadataTarget

metadataTarget?: MetadataTarget

Optional name

name?: string

Optional Readonly onFailure

onFailure?: IDestination

The destination for failed invocations.

default
  • no destination
stability

stable

Optional Readonly onSuccess

onSuccess?: IDestination

The destination for successful invocations.

default
  • no destination
stability

stable

Optional Readonly profiling

profiling?: boolean

Enable profiling.

default
  • No profiling.
see

https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html

stability

stable

Optional Readonly profilingGroup

profilingGroup?: IProfilingGroup

Profiling Group.

default
  • A new profiling group will be created if profiling is set.
see

https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html

stability

stable

Optional Readonly projectRoot

projectRoot?: string

The path to the directory containing project config files (package.json or tsconfig.json).

default
  • the directory containing the depsLockFilePath
stability

stable

Optional Readonly reservedConcurrentExecutions

reservedConcurrentExecutions?: number

The maximum of concurrent executions you want to reserve for the function.

default
  • No specific limit - account limit.
see

https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html

stability

stable

Optional Readonly retryAttempts

retryAttempts?: number

The maximum number of times to retry when the function returns an error.

Minimum: 0 Maximum: 2

default

2

stability

stable

Optional Readonly role

role?: IRole

Lambda execution 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.

The default Role automatically has permissions granted for Lambda execution. If you provide a Role, you must add the relevant AWS managed policies yourself.

The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and "service-role/AWSLambdaVPCAccessExecutionRole".

default
  • A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling addToRolePolicy.
stability

stable

Optional Readonly runtime

runtime?: Runtime

The runtime environment.

Only runtimes of the Node.js family are supported.

default

Runtime.NODEJS_14_X

stability

stable

Optional Readonly securityGroup

securityGroup?: ISecurityGroup

(deprecated) What security group to associate with the Lambda's network interfaces. This property is being deprecated, consider using securityGroups instead.

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.
deprecated
  • This property is deprecated, use securityGroups instead

Optional Readonly securityGroups

securityGroups?: ISecurityGroup[]

The list of security groups to associate with the Lambda's network interfaces.

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.
stability

stable

Optional Readonly timeout

timeout?: Duration

The function execution time (in seconds) after which Lambda terminates the function.

Because the execution time affects cost, set this value based on the function's expected execution time.

default

Duration.seconds(3)

stability

stable

Optional Readonly tracing

tracing?: Tracing

Enable AWS X-Ray Tracing for Lambda Function.

default

Tracing.Disabled

stability

stable

Optional vpc

vpc?: IVpc

VPC for functions. Defaults to database VPC if grantDatabaseAccess is true.

Optional Readonly vpcSubnets

vpcSubnets?: SubnetSelection

Where to place the network interfaces within the VPC.

Only used if 'vpc' is supplied. Note: internet access for Lambdas requires a NAT gateway, so picking Public subnets is not allowed.

default
  • the Vpc default strategy if not specified
stability

stable

Generated using TypeDoc