Skip to content

feat: Simplify Lambda deployment with zip files instead of container images #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

RayyanSeliya
Copy link

@RayyanSeliya RayyanSeliya commented Jul 9, 2025

Implements Issue #16 by replacing the complex container image approach with simple Python source code deployment for Lambda functions.

Core Implementation

  • Created Python Lambda functions (index.py) for simple and canary deployments
  • Updated function.yaml files to use S3 zip deployment instead of ECR images
  • Added cross-platform build scripts (build.sh for Linux/Mac, build.bat for Windows)
  • Created automated setup scripts for easy configuration

Documentation Updates

  • Updated prerequisites in both English and Japanese tutorials
  • Created comprehensive README and deployment guides
  • Updated deployment instructions for new zip-based approach

Technical Improvements

  • Added proper error handling in build scripts
  • Cross-platform compatibility testing

Impact

Before: Users needed Docker, ECR repository, container building knowledge
After: Users only need Python 3.9+, S3 bucket, and basic IAM role

This dramatically reduces the barrier to entry for the Lambda tutorial, making it accessible to developers without container expertise.

Testing

  • Local function execution (both simple and canary)
  • Build script functionality (Windows/Linux)
  • Zip package creation and validation
  • Cross-platform compatibility
  • AWS integration (ready for testing)

See some screenshots of the implementation

image
image

@RayyanSeliya RayyanSeliya requested a review from t-kikuc as a code owner July 9, 2025 20:57
@RayyanSeliya
Copy link
Author

hey @t-kikuc i have implemented this feature you can have a look and ping me if any changes needed i have also done some basic testing skipped the aws one coz dont have an account yet !

- Edit `lambda/canary/` as below.
- `function.yaml`: Copy from your `/src/deploy/lambda/simple/function.yaml`] and rename `name`.
- Build the canary function package: Run `./build.sh` (Linux/Mac) or `build.bat` (Windows)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a procedure without building and pushing to s3. That's troublesome.

Use the zip packing feature of PipeCD Lambda.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will research on this through https://pipecd.dev/docs-v0.52.x/user-guide/managing-application/defining-app-configuration/lambda/ and implement it accordingly

@RayyanSeliya
Copy link
Author

hey @t-kikuc made necessary changes based on your feedback ! do let me know if any changes

@RayyanSeliya RayyanSeliya requested a review from t-kikuc July 10, 2025 07:21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users cannot find this file. Move to a better place.
Do you understand the tutorial flow?

Copy link
Author

@RayyanSeliya RayyanSeliya Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @t-kikuc for your feedback. I initially focused on the Lambda ZIP deployment itself, but after your comments, I reviewed the tutorial structure to ensure my changes fit the main flow. I’ve deleted the standalone Lambda README and moved the instructions into 01-simply.md and 02-pipeline.md for clarity. Thanks again for helping me see the tutorial from the user’s perspective!

Comment on lines 5 to 16
## 🎯 What's New (Issue #16)

Previously, the Lambda tutorial required:
- ❌ Building and pushing container images to ECR
- ❌ Complex Docker setup
- ❌ ECR repository management

Now it uses:
- ✅ Simple Python source code
- ✅ **Automatic packaging by PipeCD**
- ✅ **No manual zip building or S3 uploads**
- ✅ Minimal prerequisites (just an IAM role)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary

@RayyanSeliya RayyanSeliya requested a review from t-kikuc July 10, 2025 10:42
@@ -21,8 +21,9 @@ _手順は[1. シンプルなデプロイ](01-simply.md)とほとんど同じで
- `servicedef.yaml`: `/src/deploy/ecs/simple/servicedef.yaml`からコピーして、`serviceName`を変更
- `taskdef.yaml`: `/src/deploy/ecs/simple/taskdef.yaml`からコピーして、`family`を変更
- **AWS Lambda**向け:
- あなたのイメージを利用して関数をCanaryリリースしていきます。
- `lambda/canary/`を以下のように編集してください。
- Canaryデプロイ戦略を使用してあなた自身のPythonソースコードから関数を作成します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Canaryデプロイ戦略を使用してあなた自身のPythonソースコードから関数を作成します
- Canaryデプロイ戦略を使用してPythonソースコードから関数を作成します

- You will create a function of your own image.
- Edit `lambda/simple/` as below.
- `function.yaml`: Edit `role` and `image`.
- You will create a function from your own Python source code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 'your own code'

- Edit `lambda/canary/` as below.
- `function.yaml`: Copy from your `/src/deploy/lambda/simple/function.yaml`] and rename `name`.
- You will create a function from your own Python source code using a canary deployment strategy.
- Edit `lambda/canary/function.yaml`: Copy from your `src/deploy/lambda/simple/function.yaml` and rename the `name`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you gonna copy??

Comment on lines 9 to 10
git: "" # Empty means same repository
ref: "" # Empty means current commit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did you know this spec?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did you know this spec?

hey @t-kikuc I implemented this based on the code comments and the pattern I saw in other PipeCD resources. The Helm chart docs mention that 'Empty means the same repository' (https://pipecd.dev/docs-v0.52.x/user-guide/configuration-reference/#analysis-template-configuration:~:text=Empty%20means%20the%20same%20repository), and I assumed this convention applies to Lambda functions too.

If this approach isn't correct for Lambda functions, I'd appreciate your guidance on what values should be used instead for the tutorial. Should we use explicit git/ref values or is there a better way to reference the current repository?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not helm chart.

See https://pipecd.dev/docs-v0.52.x/user-guide/managing-application/defining-app-configuration/lambda/ and https://github.com/pipe-cd/pipecd/blob/0c999367d009c143baa72785d4ad6bd841bdb189/pkg/app/piped/platformprovider/lambda/function.go#L128-L142

@t-kikuc Thank you for pointing out my mistake with the empty git / ref fields. I've corrected both function.yaml files to align exactly with the documentation at https://pipecd.dev/docs-v0.52.x/user-guide/managing-application/defining-app-configuration/lambda/#:~:text=Deploy%20source%20code,Lambda%20function%20pattern. I've maintained the same comment style as the official example while using HTTPS URLs for GitHub repositories, which is more beginner-friendly for the tutorial. The [EDIT_HERE] markers will guide users to replace these values with their own repository information.

@RayyanSeliya
Copy link
Author

hey @t-kikuc i see that i have made several mistakes and thanks for pointing out me updated some of the mistakes you can have a look and discuss about this #18 (comment)

@RayyanSeliya RayyanSeliya requested a review from t-kikuc July 12, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants