Skip to content

Lambda  >  Operations  >  delete_function

delete_function

Operation

delete_function async

delete_function(input: DeleteFunctionInput, plugins: list[Plugin] | None = None) -> DeleteFunctionOutput

Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter. Otherwise, all versions and aliases are deleted. This doesn't require the user to have explicit permissions for DeleteAlias.

Note

A deleted Lambda function cannot be recovered. Ensure that you specify the correct function name and version before deleting.

To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping. For Amazon Web Services services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.

Parameters:

Name Type Description Default
input DeleteFunctionInput

An instance of DeleteFunctionInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DeleteFunctionOutput

An instance of DeleteFunctionOutput.

Input

DeleteFunctionInput dataclass

Dataclass for DeleteFunctionInput structure.

Attributes

function_name class-attribute instance-attribute
function_name: str | None = None

The name or ARN of the Lambda function or version.

Name formats

  • Function name -- my-function (name-only), my-function:1 (with version).

  • Function ARN -- arn:aws:lambda:us-west-2:123456789012:function:my-function.

  • Partial ARN -- 123456789012:function:my-function.

You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

qualifier class-attribute instance-attribute
qualifier: str | None = None

Specify a version to delete. You can't delete a version that an alias references.

Output

DeleteFunctionOutput dataclass

Dataclass for DeleteFunctionOutput structure.

Attributes

status_code class-attribute instance-attribute
status_code: int = 0

The HTTP status code returned by the operation.