Actual connections object for this Lambda
May be unset, in which case this Lambda is not configured use in a VPC.
Mapping of invocation principals to grants. Used to de-dupe grantInvoke()
calls.
Whether the addPermission() call adds any permissions.
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
The DLQ associated with this Lambda Function (this is an optional attribute).
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
ARN of this function.
Name of this function.
The principal this Lambda Function is running as.
The construct tree node associated with this construct.
The construct node where permissions are attached.
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
"my-awesome-bucket"
)undefined
, when a name should be generated by CloudFormationExecution role associated with this function.
The runtime configured for this lambda.
The stack in which this resource is defined.
Access the Connections object.
Will fail if not a VPC-enabled Lambda Function
Returns a lambda.Version
which represents the current version of this Lambda function. A new version will be created every time the function's configuration changes.
You can specify options for this version using the currentVersionOptions
prop when initializing the lambda.Function
.
Whether or not this Lambda function was bound to a VPC.
If this is is false
, trying to access the connections
object will fail.
The $LATEST
version of this function.
Note that this is reference to a non-specific AWS Lambda version, which means the function this version refers to can return different results in different invocations.
To obtain a reference to an explicit version which references the current
function configuration, use lambdaFunction.currentVersion
instead.
The LogGroup where the Lambda function's logs are made available.
If either logRetention
is set or this property is called, a CloudFormation custom resource is added to the stack that
pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the correct log retention
period (never expire, by default).
Further, if the log group already exists and the logRetention
is not set, the custom resource will reset the log retention
to never expire even if it was configured with a different value.
Called when this resource is referenced across environments (account/region) to order to request that a physical name will be generated for this resource during synthesis, so the resource can be referenced through it's absolute name/arn.
Returns the construct tree node that corresponds to the lambda function. For use internally for constructs, when the tree is set up in non-standard ways. Ex: SingletonFunction.
Given the function arn, check if the account id matches this account
Function ARNs look like this:
arn:aws:lambda:region:account-id:function:function-name
..which means that in order to extract the account-id
component from the ARN, we can
split the ARN using ":" and select the component in index 4.
true if account id of function matches the account specified on the stack, false otherwise.
Adds an environment variable to this Lambda function.
If this is a ref to a Lambda function, this operation results in a no-op.
The environment variable key.
The environment variable's value.
Environment variable options.
Adds an event source to this function.
Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.
The following example adds an SQS Queue as an event source:
import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
myFunction.addEventSource(new SqsEventSource(myQueue));
Adds an event source that maps to this AWS Lambda function.
Adds one or more Lambda Layers to this Lambda function.
the layers to be added.
Adds a permission to the Lambda resource policy.
The id for the permission construct.
The permission to grant to this Lambda function.
Adds a statement to the IAM role assumed by the instance.
(deprecated) Add a new version for this Lambda.
If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version.
All versions should have distinct names, and you should not delete versions as long as your Alias needs to refer to them.
A unique name for this version.
The SHA-256 hash of the most recently deployed Lambda source code, or omit to skip validation.
A description for this version.
A provisioned concurrency configuration for a function's version.
configuration for this version when it is invoked asynchronously.
A new Version object.
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DELETE
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
Configures options for asynchronous invocation.
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn
).
Normally, this token will resolve to arnAttr
, but if the resource is
referenced across environments, arnComponents
will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName
in arnComponents
.
The CFN attribute which resolves to the ARN of the resource.
The format of the ARN of this resource.
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName
).
Normally, this token will resolve to nameAttr
, but if the resource is
referenced across environments, it will be resolved to this.physicalName
,
which will be a concrete name.
The CFN attribute which resolves to the resource's name.
Grant the given identity permissions to invoke this Lambda.
Return the given named metric for this Function.
How long execution of this Lambda takes.
Average over 5 minutes
How many invocations of this Lambda fail.
Sum over 5 minutes
How often this Lambda is invoked.
Sum over 5 minutes
How often this Lambda is throttled.
Sum over 5 minutes
Perform final modifications before synthesis.
This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.
This is an advanced framework feature. Only use this if you understand the implications.
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack
and Asset
as they participate in synthesizing the cloud assembly.
The synthesis session.
Validate the current construct.
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.
An array of validation error messages, or an empty array if the construct is valid.
Perform final modifications before synthesis.
This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.
This is an advanced framework feature. Only use this if you understand the implications.
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack
and Asset
as they participate in synthesizing the cloud assembly.
The synthesis session.
Returns a string representation of this construct.
Validate the current construct.
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.
An array of validation error messages, or an empty array if the construct is valid.
Record whether specific properties in the AWS::Lambda::Function
resource should also be associated to the Version resource.
See 'currentVersion' section in the module README for more details.
The property to classify.
whether the property should be associated to the version or not.
Import a lambda function into the CDK using its ARN.
Creates a Lambda function object which represents a function not defined within this stack.
The parent construct.
The name of the lambda construct.
the attributes of the function to import.
Return whether the given object is a Construct.
Check whether the given construct is a Resource.
Return the given named metric for this Lambda.
Metric for the number of concurrent executions across all Lambdas.
Metric for the Duration executing all Lambdas.
Metric for the number of Errors executing all Lambdas.
Metric for the number of invocations of all Lambdas.
Metric for the number of throttled invocations of all Lambdas.
Metric for the number of unreserved concurrent executions across all Lambdas.
Generated using TypeDoc
Lambda function with database access. Grants access to DB and secret. To use be sure to provide bundling.layer = [prismaLayer] and externalModules = prismaLayer.externalModules.