aws-sam-cli
aws-sam-cli copied to clipboard
Feature request: validate Functions meet deployment package size quota (250MB / 262144000 bytes)
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
.
- To save time with space calculations, consider caching size into
- Local invocation time: ahead of
sam local invoke
, sum size of Function and all Layers (if cached, use values frombuild.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
Thanks for opening this feature request! Let me bring this to the team for prioritization.