> **Experimental**
>
> `@aws-cdk/aws-lambda-python-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# PythonFunction

A Python Lambda function.

Extends: Construct › Resource › FunctionBase › Function › PythonFunction
Implements: IResource, IClientVpnConnectionHandler, IConnectable, IGrantable, IFunction, IEnvironmentAware, IFunctionRef, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/function.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0-alpha.0/packages/@aws-cdk/aws-lambda-python-alpha/lib/function.ts#L53)

## Example

```ts
const entry = '/path/to/function';
const image = DockerImage.fromBuild(entry);

new python.PythonFunction(this, 'function', {
  entry,
  runtime: Runtime.PYTHON_3_8,
  bundling: {
    buildArgs: { PIP_INDEX_URL: "https://your.index.url/simple/", PIP_EXTRA_INDEX_URL: "https://your.extra-index.url/simple/" },
  },
});
```

## Initializer

```ts
new PythonFunction(scope: Construct, id: string, props: PythonFunctionProps)
```

## Construct Props

- `adotInstrumentation`: [AdotInstrumentationConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotInstrumentationConfig.html) = No ADOT instrumentation — Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation.

- `allowAllIpv6Outbound`: boolean = false — Whether to allow the Lambda to send all ipv6 network traffic.

  If set to true, there will only be a single egress rule which allows all
  outbound ipv6 traffic. If set to false, you must individually add traffic rules to allow the
  Lambda to connect to network targets using ipv6.

  Do not specify this property if the `securityGroups` or `securityGroup` property is set.
  Instead, configure `allowAllIpv6Outbound` directly on the security group.

- `allowAllOutbound`: boolean = true — Whether to allow the Lambda to send all network traffic (except ipv6).

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

  Do not specify this property if the `securityGroups` or `securityGroup` property is set.
  Instead, configure `allowAllOutbound` directly on the security group.

- `allowPublicSubnet`: boolean = 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.

- `applicationLogLevel`: string = "INFO" — Use `applicationLogLevelV2` as a property instead.

- `applicationLogLevelV2`: [ApplicationLogLevel](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.ApplicationLogLevel.html) = ApplicationLogLevel.INFO — Sets the application log level for the function.

- `architecture`: [Architecture](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Architecture.html) = Architecture.X86_64 — The system architectures compatible with this lambda function.

- `bundling`: [BundlingOptions](/cdk/api/v2/docs/@aws-cdk_aws-lambda-python-alpha.BundlingOptions.html) = Use the default bundling Docker image, with x86_64 architecture. — Bundling options to use for this function.

  Use this to specify custom bundling options like
  the bundling Docker image, asset hash type, custom hash, architecture, etc.

  **Default:** Use the default bundling Docker image, with x86_64 architecture.

- `codeSigningConfig`: [ICodeSigningConfigRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_lambda.ICodeSigningConfigRef.html) = Not Sign the Code — Code signing config associated with this function.

- `currentVersionOptions`: [VersionOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.VersionOptions.html) = default options as described in `VersionOptions` — Options for the `lambda.Version` resource automatically created by the `fn.currentVersion` method.

  **Default:** default options as described in `VersionOptions`

- `deadLetterQueue`: [IQueue](/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.IQueue.html) = 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.

  **Default:** SQS queue with 14 day retention period if `deadLetterQueueEnabled` is `true`

- `deadLetterQueueEnabled`: boolean = 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.

  **Default:** false unless `deadLetterQueue` is set, which implies DLQ is enabled.

- `deadLetterTopic`: [ITopic](/cdk/api/v2/docs/aws-cdk-lib.aws_sns.ITopic.html) = 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`: string = No description. — A description of the function.

- `durableConfig`: [DurableConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.DurableConfig.html) = No durable configuration — The durable configuration for the function.

  If durability is added to an existing function, a resource replacement will be triggered.
  See the 'durableConfig' section in the module README for more details.

- `entry`: string (required) — Path to the source of the function or the location for dependencies.

- `environment`: { [key: string]: string } = 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`: [IKeyRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) = 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.

  **Default:** AWS Lambda creates and uses an AWS managed customer master key (CMK).

- `ephemeralStorageSize`: [Size](/cdk/api/v2/docs/aws-cdk-lib.Size.html) = 512 MiB — The size of the function’s /tmp directory in MiB.

- `events`: [IEventSource](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IEventSource.html)[] = No event sources. — Event sources for this function.

  You can also add event sources using `addEventSource`.

- `filesystem`: [FileSystem](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FileSystem.html) = will not mount any filesystem — The filesystem configuration for the lambda function.

- `functionName`: string = 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.

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

- `handler`: string = handler — The name of the exported handler in the index file.

- `index`: string = index.py — The path (relative to entry) to the index file containing the exported handler.

- `initialPolicy`: [PolicyStatement](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html)[] = 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.

  **Default:** No policy statements are added to the created Lambda role.

- `insightsVersion`: [LambdaInsightsVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.LambdaInsightsVersion.html) = No Lambda Insights — Specify the version of CloudWatch Lambda insights to use for monitoring.

- `ipv6AllowedForDualStack`: boolean = false — Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets.

  Only used if 'vpc' is supplied.

- `layers`: [ILayerVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.ILayerVersion.html)[] = 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.

- `logFormat`: string = "Text" — Use `loggingFormat` as a property instead.

- `loggingFormat`: [LoggingFormat](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.LoggingFormat.html) = LoggingFormat.TEXT — Sets the loggingFormat for the function.

- `logGroup`: [ILogGroupRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.ILogGroupRef.html) = `/aws/lambda/${this.functionName}` - default log group created by Lambda — The log group the function sends logs to.

  By default, Lambda functions send logs to an automatically created default log group named /aws/lambda/\<function name\>.
  However you cannot change the properties of this auto-created log group using the AWS CDK, e.g. you cannot set a different log retention.

  Use the `logGroup` property to create a fully customizable LogGroup ahead of time, and instruct the Lambda function to send logs to it.

  Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16.
  If you are deploying to another type of region, please check regional availability first.

  **Default:** `/aws/lambda/${this.functionName}` - default log group created by Lambda

- `logRemovalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.Retain — use `logGroup` instead

  Normally you want to retain the log group so you can diagnose issues
  from logs even after a deployment that no longer includes the log group.
  In that case, use the normal date-based retention policy to age out your
  logs.

- `logRetention`: [RetentionDays](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.RetentionDays.html) = logs.RetentionDays.INFINITE — use `logGroup` instead

  When updating
  this property, unsetting it doesn't remove the log retention policy. To
  remove the retention policy, set the value to `INFINITE`.

  This is a legacy API and we strongly recommend you move away from it if you can.
  Instead create a fully customizable log group with `logs.LogGroup` and use the `logGroup` property
  to instruct the Lambda function to send logs to it.
  Migrating from `logRetention` to `logGroup` will cause the name of the log group to change.
  Users and code and referencing the name verbatim will have to adjust.

  In AWS CDK code, you can access the log group name directly from the LogGroup construct:
  ```ts
  import * as logs from 'aws-cdk-lib/aws-logs';

  declare const myLogGroup: logs.LogGroup;
  myLogGroup.logGroupName;
  ```

- `logRetentionRetryOptions`: [LogRetentionRetryOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.LogRetentionRetryOptions.html) = 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.

  This is a legacy API and we strongly recommend you migrate to `logGroup` if you can.
  `logGroup` allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

- `logRetentionRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) = A new role is created. — The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

  This is a legacy API and we strongly recommend you migrate to `logGroup` if you can.
  `logGroup` allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

- `maxEventAge`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.hours(6) — The maximum age of a request that Lambda sends to a function for processing.

  Minimum: 60 seconds
  Maximum: 6 hours

- `memorySize`: number = 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.

- `onFailure`: [IDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IDestination.html) = no destination — The destination for failed invocations.

- `onSuccess`: [IDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IDestination.html) = no destination — The destination for successful invocations.

- `paramsAndSecrets`: [ParamsAndSecretsLayerVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.ParamsAndSecretsLayerVersion.html) = No Parameters and Secrets Extension — Specify the configuration of Parameters and Secrets Extension.

  **Default:** No Parameters and Secrets Extension

- `profiling`: boolean = No profiling. — Enable profiling.

- `profilingGroup`: [IProfilingGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_codeguruprofiler.IProfilingGroup.html) = A new profiling group will be created if `profiling` is set. — Profiling Group.

  **Default:** A new profiling group will be created if `profiling` is set.

- `recursiveLoop`: [RecursiveLoop](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.RecursiveLoop.html) = RecursiveLoop.Terminate — Sets the Recursive Loop Protection for Lambda Function.

  It lets Lambda detect and terminate unintended recursive loops.

- `reservedConcurrentExecutions`: number = No specific limit - account limit. — The maximum of concurrent executions you want to reserve for the function.

  **Default:** No specific limit - account limit.

- `retryAttempts`: number = 2 — The maximum number of times to retry when the function returns an error.

  Minimum: 0
  Maximum: 2

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) = 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".

  **Default:** A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling `addToRolePolicy`.

- `runtime`: [Runtime](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Runtime.html) (required) — The runtime environment.

  Only runtimes of the Python family are
  supported.

- `runtimeManagementMode`: [RuntimeManagementMode](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.RuntimeManagementMode.html) = Auto — Sets the runtime management configuration for a function's version.

- `securityGroups`: [ISecurityGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] = 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.

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

- `snapStart`: [SnapStartConf](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.SnapStartConf.html) = No snapstart — Enable SnapStart for Lambda Function.

  SnapStart is currently supported for Java 11, Java 17, Python 3.12, Python 3.13, and .NET 8 runtime,
  as well as container image (OCI) deployments.

- `systemLogLevel`: string = "INFO" — Use `systemLogLevelV2` as a property instead.

- `systemLogLevelV2`: [SystemLogLevel](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.SystemLogLevel.html) = SystemLogLevel.INFO — Sets the system log level for the function.

- `tenancyConfig`: [TenancyConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.TenancyConfig.html) = Tenant isolation is not enabled — The tenancy configuration for the function.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 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`: [Tracing](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Tracing.html) = Tracing.Disabled — Enable AWS X-Ray Tracing for Lambda Function.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) = 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.

  **Default:** Function is not placed within a VPC.

- `vpcSubnets`: [SubnetSelection](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) = 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`).

  **Default:** the Vpc default strategy if not specified

## Properties

- `architecture`: [Architecture](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Architecture.html) (required) — The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).

- `connections`: [Connections](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html) (required) — Access the Connections object.

  Will fail if not a VPC-enabled Lambda Function

- `currentVersion`: [Version](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Version.html) (required) — 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`.

- `deadLetterQueue`: [IQueue](/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.IQueue.html) — The DLQ (as queue) associated with this Lambda Function (this is an optional attribute).

- `deadLetterTopic`: [ITopic](/cdk/api/v2/docs/aws-cdk-lib.aws_sns.ITopic.html) — The DLQ (as topic) associated with this Lambda Function (this is an optional attribute).

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `functionArn`: string (required) — ARN of this function.

- `functionName`: string (required) — Name of this function.

- `functionRef`: [FunctionReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_lambda.FunctionReference.html) (required) — A reference to a Function resource.

- `grantPrincipal`: [IPrincipal](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IPrincipal.html) (required) — The principal this Lambda Function is running as.

- `isBoundToVpc`: boolean (required) — Whether or not this Lambda function was bound to a VPC.

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

- `latestVersion`: [IVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IVersion.html) (required) — 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`: [ILogGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogGroup.html) (required) — 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`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `permissionsNode`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The construct node where permissions are attached.

- `PROPERTY_INJECTION_ID`: string (required) (static) — Uniquely identifies this class.

- `resourceArnsForGrantInvoke`: string[] (required) — The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — Execution role associated with this function.

- `runtime`: [Runtime](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Runtime.html) (required) — The runtime configured for this lambda.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) (required) — The stack in which this resource is defined.

- `tenancyConfig`: [TenancyConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.TenancyConfig.html) — The tenancy configuration for this function.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — The timeout configured for this lambda.

## Methods

- `addAlias(aliasName: string, options?: AliasOptions): 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.

  ```ts
  declare const fn: lambda.Function;

  fn.addAlias('Live');

  // Is equivalent to

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

  **Parameters**

  - `aliasName` — The name of the alias.
  - `options` — Alias options.

- `addEnvironment(key: string, value: string, options?: EnvironmentOptions): 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.

  **Parameters**

  - `key` — The environment variable key.
  - `value` — The environment variable's value.
  - `options` — Environment variable options.

- `addEventSource(source: IEventSource): void` — Adds an event source to this function.

  Event sources are implemented in the aws-cdk-lib/aws-lambda-event-sources module.

  The following example adds an SQS Queue as an event source:
  ```
  import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
  myFunction.addEventSource(new SqsEventSource(myQueue));
  ```

- `addEventSourceMapping(id: string, options: EventSourceMappingOptions): EventSourceMapping` — Adds an event source that maps to this AWS Lambda function.

- `addFunctionUrl(options?: FunctionUrlOptions): FunctionUrl` — Adds a url to this lambda function.

- `addLayers(...layers: ILayerVersion[]): void` — Adds one or more Lambda Layers to this Lambda function.

  **Parameters**

  - `layers` — the layers to be added.

- `addPermission(id: string, permission: Permission): void` — Adds a permission to the Lambda resource policy.

  **Parameters**

  - `id` — The id for the permission construct.
  - `permission` — The permission to grant to this Lambda function.

- `addToRolePolicy(statement: PolicyStatement): void` — Adds a statement to the IAM role assumed by the instance.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — 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`).

- `classifyVersionProperty(propertyName: string, locked: boolean): void` (static) — 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.

  **Parameters**

  - `propertyName` — The property to classify.
  - `locked` — whether the property should be associated to the version or not.

- `configureAsyncInvoke(options: EventInvokeConfigOptions): void` — Configures options for asynchronous invocation.

- `considerWarningOnInvokeFunctionPermissions(scope: Construct, action: string): void` — 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.

- `fromFunctionArn(scope: Construct, id: string, functionArn: string): IFunction` (static) — Import a lambda function into the CDK using its ARN.

  For `Function.addPermissions()` to work on this imported lambda, make sure that is
  in the same account and region as the stack you are importing it into.

- `fromFunctionAttributes(scope: Construct, id: string, attrs: FunctionAttributes): IFunction` (static) — Creates a Lambda function object which represents a function not defined within this stack.

  For `Function.addPermissions()` to work on this imported lambda, set the sameEnvironment property to true
  if this imported lambda is in the same account and region as the stack you are importing it into.

  **Parameters**

  - `scope` — The parent construct.
  - `id` — The name of the lambda construct.
  - `attrs` — the attributes of the function to import.

- `fromFunctionName(scope: Construct, id: string, functionName: string): IFunction` (static) — Import a lambda function into the CDK using its name.

- `grantInvoke(grantee: IGrantable): Grant` — Grant the given identity permissions to invoke this Lambda.

  [disable-awslint:no-grants]

- `grantInvokeCompositePrincipal(compositePrincipal: CompositePrincipal): Grant[]` — Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.

  [disable-awslint:no-grants]

- `grantInvokeLatestVersion(grantee: IGrantable): Grant` — Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.

  [disable-awslint:no-grants]

- `grantInvokeUrl(grantee: IGrantable): Grant` — Grant the given identity permissions to invoke this Lambda Function URL.

  [disable-awslint:no-grants]

- `grantInvokeVersion(grantee: IGrantable, version: IVersion): Grant` — Grant the given identity permissions to invoke the given version of this Lambda.

  [disable-awslint:no-grants]

- `invalidateVersionBasedOn(x: string): void` — 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.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `metric(metricName: string, props?: MetricOptions): Metric` — Return the given named metric for this Function.

- `metricAll(metricName: string, props?: MetricOptions): Metric` (static) — Return the given named metric for this Lambda.

- `metricAllConcurrentExecutions(props?: MetricOptions): Metric` (static) — Metric for the number of concurrent executions across all Lambdas.

- `metricAllDuration(props?: MetricOptions): Metric` (static) — Metric for the Duration executing all Lambdas.

- `metricAllErrors(props?: MetricOptions): Metric` (static) — Metric for the number of Errors executing all Lambdas.

- `metricAllInvocations(props?: MetricOptions): Metric` (static) — Metric for the number of invocations of all Lambdas.

- `metricAllThrottles(props?: MetricOptions): Metric` (static) — Metric for the number of throttled invocations of all Lambdas.

- `metricAllUnreservedConcurrentExecutions(props?: MetricOptions): Metric` (static) — Metric for the number of unreserved concurrent executions across all Lambdas.

- `metricDuration(props?: MetricOptions): Metric` — How long execution of this Lambda takes.

  Average over 5 minutes

- `metricErrors(props?: MetricOptions): Metric` — How many invocations of this Lambda fail.

  Sum over 5 minutes

- `metricInvocations(props?: MetricOptions): Metric` — How often this Lambda is invoked.

  Sum over 5 minutes

- `metricThrottles(props?: MetricOptions): Metric` — How often this Lambda is throttled.

  Sum over 5 minutes

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
