upload¶
Lambda layer S3 upload implementation - Step 3 of the layer creation workflow.
This module handles the upload phase of AWS Lambda layer deployment, transferring the packaged layer zip file to S3 storage where it can be accessed by AWS Lambda for layer creation and publication.
- aws_lambda_artifact_builder.layer.upload.upload_layer_zip_to_s3(s3_client: S3Client, path_pyproject_toml: ~pathlib.Path, s3dir_lambda: S3Path, layer_build_tool: ~aws_lambda_artifact_builder.constants.LayerBuildToolEnum, verbose: bool = True, printer: ~typing.Callable[[str], None] = <built-in function print>)[source]¶
Upload Lambda layer zip file to S3 storage for deployment (Public API).
This function uploads the packaged layer zip file to S3 using an organized directory structure that supports versioning and artifact management. The uploaded artifact becomes available for Lambda layer creation and can be referenced by AWS Lambda service for layer publication.
S3 Upload Process:
Source: Local
build/lambda/layer/layer.zipfrom packaging stepTarget: S3 path organized by
LayerS3LayoutstructureUpload Method: Direct S3 upload with overwrite capability
Access Control: Uses provided S3 client credentials and permissions
S3 Path Organization:
The function uses
LayerS3Layoutto determine the target S3 path, which typically follows a pattern like:s3://bucket/lambda/layers/temp/layer-{timestamp}.zipThis organized structure allows for:
Temporary Storage: Uploaded to temp location before layer publication
Unique Naming: Timestamp-based naming prevents conflicts
Easy Management: Consistent path structure for automated operations
Progress Reporting:
The function provides detailed progress information including:
Upload source and destination paths
AWS Console URL for browser-based verification
Upload completion status
- Parameters:
s3_client – Configured boto3 S3 client with appropriate permissions
path_pyproject_toml – Path to pyproject.toml file (determines project root and zip location)
s3dir_lambda – S3 directory path where Lambda artifacts are stored
layer_build_tool – Build tool used to create dependencies (pip/poetry/uv)
verbose – If True, shows detailed upload progress; if False, runs with minimal output
printer – Function to handle progress messages, defaults to print