airflow.providers.amazon.aws.operators.lambda_function

Module Contents

Classes

LambdaCreateFunctionOperator

Creates an AWS Lambda function.

AwsLambdaInvokeFunctionOperator

Invokes an AWS Lambda function. You can invoke a function synchronously (and wait for the response),

class airflow.providers.amazon.aws.operators.lambda_function.LambdaCreateFunctionOperator(*, function_name, runtime=None, role, handler=None, code, description=None, timeout=None, config={}, wait_for_completion=False, aws_conn_id='aws_default', **kwargs)[source]

Bases: airflow.models.BaseOperator

Creates an AWS Lambda function.

More information regarding parameters of this operator can be found here https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.create_function

See also

For more information on how to use this operator, take a look at the guide: Create an AWS Lambda function

Parameters
  • function_name (str) – The name of the AWS Lambda function, version, or alias.

  • runtime (str | None) – The identifier of the function’s runtime. Runtime is required if the deployment package is a .zip file archive.

  • role (str) – The Amazon Resource Name (ARN) of the function’s execution role.

  • handler (str | None) – The name of the method within your code that Lambda calls to run your function. Handler is required if the deployment package is a .zip file archive.

  • code (dict) – The code for the function.

  • description (str | None) – A description of the function.

  • timeout (int | None) – The amount of time (in seconds) that Lambda allows a function to run before stopping it.

  • config (dict) – Optional dictionary for arbitrary parameters to the boto API create_lambda call.

  • wait_for_completion (bool) – If True, the operator will wait until the function is active.

  • aws_conn_id (str) – The AWS connection ID to use

template_fields :Sequence[str] = ['function_name', 'runtime', 'role', 'handler', 'code', 'config'][source]
ui_color = #ff7300[source]
hook()[source]
execute(context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.amazon.aws.operators.lambda_function.AwsLambdaInvokeFunctionOperator(*, function_name, log_type=None, qualifier=None, invocation_type=None, client_context=None, payload=None, aws_conn_id='aws_default', **kwargs)[source]

Bases: airflow.models.BaseOperator

Invokes an AWS Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. To invoke a function asynchronously, set invocation_type to Event. For more details, review the boto3 Lambda invoke docs.

See also

For more information on how to use this operator, take a look at the guide: Invoke an AWS Lambda function

Parameters
  • function_name (str) – The name of the AWS Lambda function, version, or alias.

  • log_type (str | None) – Set to Tail to include the execution log in the response. Otherwise, set to “None”.

  • qualifier (str | None) – Specify a version or alias to invoke a published version of the function.

  • invocation_type (str | None) – AWS Lambda invocation type (RequestResponse, Event, DryRun)

  • client_context (str | None) – Data about the invoking client to pass to the function in the context object

  • payload (str | None) – JSON provided as input to the Lambda function

  • aws_conn_id (str) – The AWS connection ID to use

template_fields :Sequence[str] = ['function_name', 'payload', 'qualifier', 'invocation_type'][source]
ui_color = #ff7300[source]
hook()[source]
execute(context)[source]

Invokes the target AWS Lambda function from Airflow.

Returns

The response payload from the function, or an error object.

Was this entry helpful?