aws / aws/aws-sam-cli

Feature request: validate Functions meet deployment package size quota (250MB / 262144000 bytes)

Open
#6,373 1 comment 0 reactions 0 assignees View on GitHub
type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

Currently, if a Function and its Layers exceed the deployment package size quota of "250MB" (in reality 262144000 bytes), a user won't discover this until running `sam deploy` and CloudFormation emits an error along the lines of `Unzipped size must be smaller than 262144000 bytes` (or lower, depending on what caused the quota to be exceeded and when).

Ideally, SAM would detect a pending problem during development of a Function/LayerVersion that will exceed the quota, either checking the unzipped size at build time, and separately during invocation of a Function, since the quota applies to the Function and all its Layers. By checking this ahead of time, development time improved with early detection of size issues. Equally, checking sizes just before deploying would avoid failed deploys and rollbacks, and the time required to reach this point for zipping/uploads/etc.

### Proposal

* Build time: after building a Function or Layer, check the size. Error if over quota.
* To save time with space calculations, consider caching size into `build.toml`.
* Local invocation time: ahead of `sam local invoke`, sum size of Function and all Layers (if cached, use values from `build.toml`. Error if over quota.
* Deploy time: ahead of creating zips for `sam deploy`, check size and perform sums for Functions and their Layers. Error if any over quota.

### Additional Details

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.