aws-amplify / aws-amplify/amplify-cli

Lambda Zip Compression Level is Weak

Open
#10,542 2 comments 1 reaction 0 assignees View on GitHub
feature-request functions p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

_No response_

### Is this related to another service?

Lambda

### Describe the feature you'd like to request

I noticed that the amplify-cli compresses my 16 MB go binary down to 15 MB:
```
christopheclapp@Christophes-MacBook-Air src % du -h ../bin/main
16M ../bin/main
christopheclapp@Christophes-MacBook-Air src % du -h ../dist/latest-build.zip
15M ../dist/latest-build.zip
```
However, when I zip it myself, I get a much smaller zip file:
```
christopheclapp@Christophes-MacBook-Air bin % zip -9 lambda.zip main
adding: main (deflated 57%)
christopheclapp@Christophes-MacBook-Air bin % du -h lambda.zip
7.4M lambda.zip
```

Can we have the zip compression level be improved and/or make it configurable?

### Describe the solution you'd like

Use the best zip compression level possible when packaging lambdas and/or make it customizable. As you are aware, having a zip file that is double the size necessary negatively impacts lambda cold-start.

### Describe alternatives you've considered

The alternative would be to bypass amplify-cli for managing the packaging and deploying of the lambda.

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

The issue names Amplify CLI Lambda packaging but no source file, test, or entry point. Trace the Lambda packaging flow and determine how compression is selected; done means the generated archive uses improved or configurable compression and the behavior is covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.