workflow

All-in-one Lambda layer workflow - Build, Package, Upload, and Publish in one place.

This module provides a unified workflow class that combines all four steps of Lambda layer creation:

  1. Build: Install dependencies using containerized build tools

  2. Package: Create optimized zip archives

  3. Upload: Deploy artifacts to S3 storage

  4. Publish: Create versioned Lambda layers with intelligent change detection

class aws_lambda_artifact_builder.layer.workflow.LambdaLayerBuildPackageUploadAndPublishWorkflow(verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>, layer_name: str = REQ, py_ver_major: int = REQ, py_ver_minor: int = REQ, credentials: ~aws_lambda_artifact_builder.layer.foundation.Credentials | None = None, is_arm: bool = False, path_pyproject_toml: ~pathlib.Path = REQ, s3dir_lambda: S3Path = REQ, s3_client: S3Client = REQ, lambda_client: LambdaClient = REQ, layer_build_tool: ~aws_lambda_artifact_builder.constants.LayerBuildToolEnum = REQ, ignore_package_list: list[str] | None = None, publish_layer_version_kwargs: dict[str, ~typing.Any] | None = None)[source]

All-in-one workflow for Lambda layer creation and deployment.

This class orchestrates the complete Lambda layer lifecycle in a single interface, combining build, package, upload, and publish operations. It provides both unified execution via run() and granular control through individual step methods.

Workflow Steps:

  1. step_1_build() - Uses container-based builders from build

  2. step_2_package() - Creates optimized zip using LambdaLayerZipper

  3. step_3_upload() - Deploys to S3 via upload_layer_zip_to_s3()

  4. step_4_publish() - Creates layer versions with LambdaLayerVersionPublisher

Multi-Tool Support:

The workflow automatically selects the appropriate builder based on layer_build_tool:

  • PipBasedLambdaLayerContainerBuilder for pip

  • PoetryBasedLambdaLayerContainerBuilder for Poetry

  • UVBasedLambdaLayerContainerBuilder for UV

Usage Example:

workflow = BuildPackageUploadAndPublishWorkflow(
    layer_name="my-python-deps",
    py_ver_major=3, py_ver_minor=11,
    path_pyproject_toml=Path("pyproject.toml"),
    s3dir_lambda=S3Path("s3://bucket/lambda/"),
    s3_client=s3_client,
    lambda_client=lambda_client, 
    layer_build_tool=LayerBuildToolEnum.uv,
)

# Execute complete workflow
workflow.run()

# Or execute individual steps
workflow.build()
workflow.package() 
workflow.upload()
workflow.publish()
Parameters:
  • layer_name – Name for the Lambda layer

  • py_ver_major – Python major version (e.g., 3)

  • py_ver_minor – Python minor version (e.g., 11)

  • credentials – Optional private repository credentials

  • is_arm – Whether to build for ARM64 architecture (default: False)

  • path_pyproject_toml – Path to project’s pyproject.toml file

  • s3dir_lambda – S3 directory for Lambda artifacts

  • s3_client – Boto3 S3 client for uploads

  • lambda_client – Boto3 Lambda client for layer publishing

  • layer_build_tool – Build tool to use (pip/poetry/uv)

  • ignore_package_list – Packages to exclude from layer zip

  • publish_layer_version_kwargs – Additional Lambda API parameters