@aws-cdk_aws-lambda-go-alpha.GoFunction

class GoFunction (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Lambda.Go.Alpha.GoFunction
Gogithub.com/aws/aws-cdk-go/awscdklambdagoalpha/v2#GoFunction
Javasoftware.amazon.awscdk.services.lambda.go.alpha.GoFunction
Pythonaws_cdk.aws_lambda_go_alpha.GoFunction
TypeScript (source)@aws-cdk/aws-lambda-go-alpha ยป GoFunction

Implements IConstruct, IDependable, IResource, IFunction, IConnectable, IGrantable, IClientVpnConnectionHandler

A Golang Lambda function.

Example

new go.GoFunction(this, 'handler', {
  entry: 'app/cmd/api',
  bundling: {
    dockerImage: DockerImage.fromBuild('/path/to/Dockerfile'),
  },
});

Initializer

new GoFunction(scope: Construct, id: string, props: GoFunctionProps)

Parameters

  • scope Construct
  • id string
  • props GoFunctionProps

Construct Props

NameTypeDescription
entry๐Ÿ”นstringThe path to the folder or file that contains the main application entry point files for the project.
adotInstrumentation?๐Ÿ”นAdotInstrumentationConfigSpecify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation.
allowAllOutbound?๐Ÿ”นbooleanWhether to allow the Lambda to send all network traffic.
allowPublicSubnet?๐Ÿ”นbooleanLambda Functions in a public subnet can NOT access the internet.
architecture?๐Ÿ”นArchitectureThe system architectures compatible with this lambda function.
bundling?๐Ÿ”นBundlingOptionsBundling options.
codeSigningConfig?๐Ÿ”นICodeSigningConfigCode signing config associated with this function.
currentVersionOptions?๐Ÿ”นVersionOptionsOptions for the lambda.Version resource automatically created by the fn.currentVersion method.
deadLetterQueue?๐Ÿ”นIQueueThe SQS queue to use if DLQ is enabled.
deadLetterQueueEnabled?๐Ÿ”นbooleanEnabled DLQ.
deadLetterTopic?๐Ÿ”นITopicThe SNS topic to use as a DLQ.
description?๐Ÿ”นstringA description of the function.
environment?๐Ÿ”น{ [string]: string }Key-value pairs that Lambda caches and makes available for your Lambda functions.
environmentEncryption?๐Ÿ”นIKeyThe AWS KMS key that's used to encrypt your function's environment variables.
ephemeralStorageSize?๐Ÿ”นSizeThe size of the functionโ€™s /tmp directory in MiB.
events?๐Ÿ”นIEventSource[]Event sources for this function.
filesystem?๐Ÿ”นFileSystemThe filesystem configuration for the lambda function.
functionName?๐Ÿ”นstringA name for the function.
initialPolicy?๐Ÿ”นPolicyStatement[]Initial policy statements to add to the created Lambda Role.
insightsVersion?๐Ÿ”นLambdaInsightsVersionSpecify the version of CloudWatch Lambda insights to use for monitoring.
layers?๐Ÿ”นILayerVersion[]A list of layers to add to the function's execution environment.
logRetention?๐Ÿ”นRetentionDaysThe number of days log events are kept in CloudWatch Logs.
logRetentionRetryOptions?๐Ÿ”นLogRetentionRetryOptionsWhen log retention is specified, a custom resource attempts to create the CloudWatch log group.
logRetentionRole?๐Ÿ”นIRoleThe IAM role for the Lambda function associated with the custom resource that sets the retention policy.
maxEventAge?๐Ÿ”นDurationThe maximum age of a request that Lambda sends to a function for processing.
memorySize?๐Ÿ”นnumberThe amount of memory, in MB, that is allocated to your Lambda function.
moduleDir?๐Ÿ”นstringDirectory containing your go.mod file.
onFailure?๐Ÿ”นIDestinationThe destination for failed invocations.
onSuccess?๐Ÿ”นIDestinationThe destination for successful invocations.
paramsAndSecrets?๐Ÿ”นParamsAndSecretsLayerVersionSpecify the configuration of Parameters and Secrets Extension.
profiling?๐Ÿ”นbooleanEnable profiling.
profilingGroup?๐Ÿ”นIProfilingGroupProfiling Group.
reservedConcurrentExecutions?๐Ÿ”นnumberThe maximum of concurrent executions you want to reserve for the function.
retryAttempts?๐Ÿ”นnumberThe maximum number of times to retry when the function returns an error.
role?๐Ÿ”นIRoleLambda execution role.
runtime?๐Ÿ”นRuntimeThe runtime environment.
runtimeManagementMode?๐Ÿ”นRuntimeManagementModeSets the runtime management configuration for a function's version.
securityGroups?๐Ÿ”นISecurityGroup[]The list of security groups to associate with the Lambda's network interfaces.
timeout?๐Ÿ”นDurationThe function execution time (in seconds) after which Lambda terminates the function.
tracing?๐Ÿ”นTracingEnable AWS X-Ray Tracing for Lambda Function.
vpc?๐Ÿ”นIVpcVPC network to place Lambda network interfaces.
vpcSubnets?๐Ÿ”นSubnetSelectionWhere to place the network interfaces within the VPC.

entry๐Ÿ”น

Type: string

The path to the folder or file that contains the main application entry point files for the project.

This accepts either a path to a directory or file.

If a directory path is provided then it will assume there is a Go entry file (i.e. main.go) and will construct the build command using the directory path.

For example, if you provide the entry as:

entry: 'my-lambda-app/cmd/api'

Then the go build command would be:

`go build ./cmd/api`

If a path to a file is provided then it will use the filepath in the build command.

For example, if you provide the entry as:

entry: 'my-lambda-app/cmd/api/main.go'

Then the go build command would be:

`go build ./cmd/api/main.go`

adotInstrumentation?๐Ÿ”น

Type: AdotInstrumentationConfig (optional, default: No ADOT instrumentation)

Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation.

See also: https://aws-otel.github.io/docs/getting-started/lambda


allowAllOutbound?๐Ÿ”น

Type: boolean (optional, default: true)

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.


allowPublicSubnet?๐Ÿ”น

Type: boolean (optional, default: false)

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.

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


architecture?๐Ÿ”น

Type: Architecture (optional, default: Architecture.X86_64)

The system architectures compatible with this lambda function.


bundling?๐Ÿ”น

Type: BundlingOptions (optional, default: use default bundling options)

Bundling options.


codeSigningConfig?๐Ÿ”น

Type: ICodeSigningConfig (optional, default: Not Sign the Code)

Code signing config associated with this function.


currentVersionOptions?๐Ÿ”น

Type: VersionOptions (optional, default: default options as described in VersionOptions)

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


deadLetterQueue?๐Ÿ”น

Type: IQueue (optional, default: SQS queue with 14 day retention period if deadLetterQueueEnabled is true)

The SQS queue to use if DLQ is enabled.

If SNS topic is desired, specify deadLetterTopic property instead.


deadLetterQueueEnabled?๐Ÿ”น

Type: boolean (optional, default: false unless deadLetterQueue is set, which implies DLQ is enabled.)

Enabled DLQ.

If deadLetterQueue is undefined, an SQS queue with default options will be defined for your Function.


deadLetterTopic?๐Ÿ”น

Type: ITopic (optional, default: no SNS topic)

The SNS topic to use as a DLQ.

Note that if deadLetterQueueEnabled is set to true, an SQS queue will be created rather than an SNS topic. Using an SNS topic as a DLQ requires this property to be set explicitly.


description?๐Ÿ”น

Type: string (optional, default: No description.)

A description of the function.


environment?๐Ÿ”น

Type: { [string]: string } (optional, default: No environment variables.)

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.


environmentEncryption?๐Ÿ”น

Type: IKey (optional, default: AWS Lambda creates and uses an AWS managed customer master key (CMK).)

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


ephemeralStorageSize?๐Ÿ”น

Type: Size (optional, default: 512 MiB)

The size of the functionโ€™s /tmp directory in MiB.


events?๐Ÿ”น

Type: IEventSource[] (optional, default: No event sources.)

Event sources for this function.

You can also add event sources using addEventSource.


filesystem?๐Ÿ”น

Type: FileSystem (optional, default: will not mount any filesystem)

The filesystem configuration for the lambda function.


functionName?๐Ÿ”น

Type: string (optional, default: AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.)

A name for the function.


initialPolicy?๐Ÿ”น

Type: PolicyStatement[] (optional, default: No policy statements are added to the created Lambda role.)

Initial policy statements to add to the created Lambda Role.

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


insightsVersion?๐Ÿ”น

Type: LambdaInsightsVersion (optional, default: No Lambda Insights)

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

See also: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-Getting-Started-docker.html


layers?๐Ÿ”น

Type: ILayerVersion[] (optional, default: No layers.)

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.


logRetention?๐Ÿ”น

Type: RetentionDays (optional, default: logs.RetentionDays.INFINITE)

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.


logRetentionRetryOptions?๐Ÿ”น

Type: LogRetentionRetryOptions (optional, default: Default AWS SDK retry options.)

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.


logRetentionRole?๐Ÿ”น

Type: IRole (optional, default: A new role is created.)

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


maxEventAge?๐Ÿ”น

Type: Duration (optional, default: Duration.hours(6))

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

Minimum: 60 seconds Maximum: 6 hours


memorySize?๐Ÿ”น

Type: number (optional, default: 128)

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.


moduleDir?๐Ÿ”น

Type: string (optional, default: the path is found by walking up parent directories searching for a go.mod file from the location of entry)

Directory containing your go.mod file.

This will accept either a directory path containing a go.mod file or a filepath to your go.mod file (i.e. path/to/go.mod).

This will be used as the source of the volume mounted in the Docker container and will be the directory where it will run go build from.


onFailure?๐Ÿ”น

Type: IDestination (optional, default: no destination)

The destination for failed invocations.


onSuccess?๐Ÿ”น

Type: IDestination (optional, default: no destination)

The destination for successful invocations.


paramsAndSecrets?๐Ÿ”น

Type: ParamsAndSecretsLayerVersion (optional, default: No Parameters and Secrets Extension)

Specify the configuration of Parameters and Secrets Extension.

See also: https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html


profiling?๐Ÿ”น

Type: boolean (optional, default: No profiling.)

Enable profiling.

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


profilingGroup?๐Ÿ”น

Type: IProfilingGroup (optional, default: A new profiling group will be created if profiling is set.)

Profiling Group.

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


reservedConcurrentExecutions?๐Ÿ”น

Type: number (optional, default: No specific limit - account limit.)

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

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


retryAttempts?๐Ÿ”น

Type: number (optional, default: 2)

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

Minimum: 0 Maximum: 2


role?๐Ÿ”น

Type: IRole (optional, default: A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling addToRolePolicy.)

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


runtime?๐Ÿ”น

Type: Runtime (optional, default: lambda.Runtime.PROVIDED_AL2)

The runtime environment.

Only runtimes of the Golang family and provided family are supported.


runtimeManagementMode?๐Ÿ”น

Type: RuntimeManagementMode (optional, default: Auto)

Sets the runtime management configuration for a function's version.


securityGroups?๐Ÿ”น

Type: ISecurityGroup[] (optional, 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.)

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

Only used if 'vpc' is supplied.


timeout?๐Ÿ”น

Type: Duration (optional, default: Duration.seconds(3))

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.


tracing?๐Ÿ”น

Type: Tracing (optional, default: Tracing.Disabled)

Enable AWS X-Ray Tracing for Lambda Function.


vpc?๐Ÿ”น

Type: IVpc (optional, default: Function is not placed within a VPC.)

VPC network to place Lambda network interfaces.

Specify this if the Lambda function needs to access resources in a VPC. This is required when vpcSubnets is specified.


vpcSubnets?๐Ÿ”น

Type: SubnetSelection (optional, default: the Vpc default strategy if not specified)

Where to place the network interfaces within the VPC.

This requires vpc to be specified in order for interfaces to actually be placed in the subnets. If vpc is not specify, this will raise an error.

Note: Internet access for Lambda Functions requires a NAT Gateway, so picking public subnets is not allowed (unless allowPublicSubnet is set to true).

Properties

NameTypeDescription
architecture๐Ÿ”นArchitectureThe architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).
connections๐Ÿ”นConnectionsAccess the Connections object.
currentVersion๐Ÿ”นVersionReturns 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.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
functionArn๐Ÿ”นstringARN of this function.
functionName๐Ÿ”นstringName of this function.
grantPrincipal๐Ÿ”นIPrincipalThe principal this Lambda Function is running as.
isBoundToVpc๐Ÿ”นbooleanWhether or not this Lambda function was bound to a VPC.
latestVersion๐Ÿ”นIVersionThe $LATEST version of this function.
logGroup๐Ÿ”นILogGroupThe LogGroup where the Lambda function's logs are made available.
node๐Ÿ”นNodeThe tree node.
permissionsNode๐Ÿ”นNodeThe construct node where permissions are attached.
resourceArnsForGrantInvoke๐Ÿ”นstring[]The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
runtime๐Ÿ”นRuntimeThe runtime configured for this lambda.
stack๐Ÿ”นStackThe stack in which this resource is defined.
deadLetterQueue?๐Ÿ”นIQueueThe DLQ (as queue) associated with this Lambda Function (this is an optional attribute).
deadLetterTopic?๐Ÿ”นITopicThe DLQ (as topic) associated with this Lambda Function (this is an optional attribute).
role?๐Ÿ”นIRoleExecution role associated with this function.
timeout?๐Ÿ”นDurationThe timeout configured for this lambda.
static GOOGLE_GOPROXY๐Ÿ”นstringThe address of the Google Go proxy.

architecture๐Ÿ”น

Type: Architecture

The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).


connections๐Ÿ”น

Type: Connections

Access the Connections object.

Will fail if not a VPC-enabled Lambda Function


currentVersion๐Ÿ”น

Type: Version

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.


env๐Ÿ”น

Type: ResourceEnvironment

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.


functionArn๐Ÿ”น

Type: string

ARN of this function.


functionName๐Ÿ”น

Type: string

Name of this function.


grantPrincipal๐Ÿ”น

Type: IPrincipal

The principal this Lambda Function is running as.


isBoundToVpc๐Ÿ”น

Type: boolean

Whether or not this Lambda function was bound to a VPC.

If this is is false, trying to access the connections object will fail.


latestVersion๐Ÿ”น

Type: IVersion

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.


logGroup๐Ÿ”น

Type: ILogGroup

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.


node๐Ÿ”น

Type: Node

The tree node.


permissionsNode๐Ÿ”น

Type: Node

The construct node where permissions are attached.


resourceArnsForGrantInvoke๐Ÿ”น

Type: string[]

The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().


runtime๐Ÿ”น

Type: Runtime

The runtime configured for this lambda.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


deadLetterQueue?๐Ÿ”น

Type: IQueue (optional)

The DLQ (as queue) associated with this Lambda Function (this is an optional attribute).


deadLetterTopic?๐Ÿ”น

Type: ITopic (optional)

The DLQ (as topic) associated with this Lambda Function (this is an optional attribute).


role?๐Ÿ”น

Type: IRole (optional)

Execution role associated with this function.


timeout?๐Ÿ”น

Type: Duration (optional)

The timeout configured for this lambda.


static GOOGLE_GOPROXY๐Ÿ”น

Type: string

The address of the Google Go proxy.

Methods

NameDescription
addAlias(aliasName, options?)๐Ÿ”นDefines an alias for this function.
addEnvironment(key, value, options?)๐Ÿ”นAdds an environment variable to this Lambda function.
addEventSource(source)๐Ÿ”นAdds an event source to this function.
addEventSourceMapping(id, options)๐Ÿ”นAdds an event source that maps to this AWS Lambda function.
addFunctionUrl(options?)๐Ÿ”นAdds a url to this lambda function.
addLayers(...layers)๐Ÿ”นAdds one or more Lambda Layers to this Lambda function.
addPermission(id, permission)๐Ÿ”นAdds a permission to the Lambda resource policy.
addToRolePolicy(statement)๐Ÿ”นAdds a statement to the IAM role assumed by the instance.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
configureAsyncInvoke(options)๐Ÿ”นConfigures options for asynchronous invocation.
considerWarningOnInvokeFunctionPermissions(scope, action)๐Ÿ”นA warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction are added to the unqualified function.
grantInvoke(grantee)๐Ÿ”นGrant the given identity permissions to invoke this Lambda.
grantInvokeUrl(grantee)๐Ÿ”นGrant the given identity permissions to invoke this Lambda Function URL.
invalidateVersionBasedOn(x)๐Ÿ”นMix additional information into the hash of the Version object.
metric(metricName, props?)๐Ÿ”นReturn the given named metric for this Function.
metricDuration(props?)๐Ÿ”นHow long execution of this Lambda takes.
metricErrors(props?)๐Ÿ”นHow many invocations of this Lambda fail.
metricInvocations(props?)๐Ÿ”นHow often this Lambda is invoked.
metricThrottles(props?)๐Ÿ”นHow often this Lambda is throttled.
toString()๐Ÿ”นReturns a string representation of this construct.

addAlias(aliasName, options?)๐Ÿ”น

public addAlias(aliasName: string, options?: AliasOptions): Alias

Parameters

  • aliasName string โ€” The name of the alias.
  • options AliasOptions โ€” Alias options.

Returns

  • Alias

Defines an alias for this function.

The alias will automatically be updated to point to the latest version of the function as it is being updated during a deployment.

declare const fn: lambda.Function;

fn.addAlias('Live');

// Is equivalent to

new lambda.Alias(this, 'AliasLive', {
  aliasName: 'Live',
  version: fn.currentVersion,
});

addEnvironment(key, value, options?)๐Ÿ”น

public addEnvironment(key: string, value: string, options?: EnvironmentOptions): Function

Parameters

  • key string โ€” The environment variable key.
  • value string โ€” The environment variable's value.
  • options EnvironmentOptions โ€” Environment variable options.

Returns

  • Function

Adds an environment variable to this Lambda function.

If this is a ref to a Lambda function, this operation results in a no-op.


addEventSource(source)๐Ÿ”น

public addEventSource(source: IEventSource): void

Parameters

  • source IEventSource

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));

addEventSourceMapping(id, options)๐Ÿ”น

public addEventSourceMapping(id: string, options: EventSourceMappingOptions): EventSourceMapping

Parameters

  • id string
  • options EventSourceMappingOptions

Returns

  • EventSourceMapping

Adds an event source that maps to this AWS Lambda function.


addFunctionUrl(options?)๐Ÿ”น

public addFunctionUrl(options?: FunctionUrlOptions): FunctionUrl

Parameters

  • options FunctionUrlOptions

Returns

  • FunctionUrl

Adds a url to this lambda function.


addLayers(...layers)๐Ÿ”น

public addLayers(...layers: ILayerVersion[]): void

Parameters

  • layers ILayerVersion โ€” the layers to be added.

Adds one or more Lambda Layers to this Lambda function.


addPermission(id, permission)๐Ÿ”น

public addPermission(id: string, permission: Permission): void

Parameters

  • id string โ€” The id for the permission construct.
  • permission Permission โ€” The permission to grant to this Lambda function.

Adds a permission to the Lambda resource policy.

See also: [Permission for details.](Permission for details.)


addToRolePolicy(statement)๐Ÿ”น

public addToRolePolicy(statement: PolicyStatement): void

Parameters

  • statement PolicyStatement

Adds a statement to the IAM role assumed by the instance.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


configureAsyncInvoke(options)๐Ÿ”น

public configureAsyncInvoke(options: EventInvokeConfigOptions): void

Parameters

  • options EventInvokeConfigOptions

Configures options for asynchronous invocation.


considerWarningOnInvokeFunctionPermissions(scope, action)๐Ÿ”น

public considerWarningOnInvokeFunctionPermissions(scope: Construct, action: string): void

Parameters

  • scope Construct
  • action string

A warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction are added to the unqualified function.

  • function.currentVersion is invoked before or after the permission is created.

This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase.


grantInvoke(grantee)๐Ÿ”น

public grantInvoke(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant the given identity permissions to invoke this Lambda.


grantInvokeUrl(grantee)๐Ÿ”น

public grantInvokeUrl(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant the given identity permissions to invoke this Lambda Function URL.


invalidateVersionBasedOn(x)๐Ÿ”น

public invalidateVersionBasedOn(x: string): void

Parameters

  • x string

Mix additional information into the hash of the Version object.

The Lambda Function construct does its best to automatically create a new Version when anything about the Function changes (its code, its layers, any of the other properties).

However, you can sometimes source information from places that the CDK cannot look into, like the deploy-time values of SSM parameters. In those cases, the CDK would not force the creation of a new Version object when it actually should.

This method can be used to invalidate the current Version object. Pass in any string into this method, and make sure the string changes when you know a new Version needs to be created.

This method may be called more than once.


metric(metricName, props?)๐Ÿ”น

public metric(metricName: string, props?: MetricOptions): Metric

Parameters

  • metricName string
  • props MetricOptions

Returns

  • Metric

Return the given named metric for this Function.


metricDuration(props?)๐Ÿ”น

public metricDuration(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

How long execution of this Lambda takes.

Average over 5 minutes


metricErrors(props?)๐Ÿ”น

public metricErrors(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

How many invocations of this Lambda fail.

Sum over 5 minutes


metricInvocations(props?)๐Ÿ”น

public metricInvocations(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

How often this Lambda is invoked.

Sum over 5 minutes


metricThrottles(props?)๐Ÿ”น

public metricThrottles(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

How often this Lambda is throttled.

Sum over 5 minutes


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.