This module contains helper methods related to Lambda.
Lambda(function_arn: str = None, function_name: str = None, execution_role_arn: str = None, zipped_code_dir: str = None, s3_bucket: str = None, script: str = None, handler: str = None, session: sagemaker.session.Session = None, timeout: int = 120, memory_size: int = 128, runtime: str = 'python3.8')¶
Contains lambda boto3 wrappers to Create, Update, Delete and Invoke Lambda functions.
Constructs a Lambda instance.
This instance represents a Lambda function and provides methods for updating, deleting and invoking the function.
This class can be used either for creating a new Lambda function or using an existing one. When using an existing Lambda function, only the function_arn argument is required. When creating a new one the function_name, execution_role_arn and handler arguments are required, as well as either script or zipped_code_dir.
function_arn (str) – The arn of the Lambda function.
function_name (str) – The name of the Lambda function. Function name must be provided to create a Lambda function.
execution_role_arn (str) – The role to be attached to Lambda function.
zipped_code_dir (str) – The path of the zipped code package of the Lambda function.
s3_bucket (str) – The bucket where zipped code is uploaded. If not provided, default session bucket is used to upload zipped_code_dir.
script (str) – The path of Lambda function script for direct zipped upload
handler (str) – The Lambda handler. The format for handler should be file_name.function_name. For ex: if the name of the Lambda script is hello_world.py and Lambda function definition in that script is lambda_handler(event, context), the handler should be hello_world.lambda_handler
session (sagemaker.session.Session) – Session object which manages interactions with Amazon SageMaker APIs and any other AWS services needed. If not specified, new session is created.
timeout (int) – Timeout of the Lambda function in seconds. Default is 120 seconds.
memory_size (int) – Memory of the Lambda function in megabytes. Default is 128 MB.
runtime (str) – Runtime of the Lambda function. Default is set to python3.8.
Method to create a lambda function.
Returns: boto3 response from Lambda’s create_function method.
Method to update a lambda function.
Returns: boto3 response from Lambda’s update_function method.
Method to create a lambda function or update it if it already exists
Returns: boto3 response from Lambda’s methods.
Method to invoke a lambda function.
Returns: boto3 response from Lambda’s invoke method.
Method to delete a lambda function.
Returns: boto3 response from Lambda’s delete_function method.