A developer is assembling a Lambda function that already attaches four layers for shared utilities. They want to add a fifth layer for a new dependency and are reviewing the constraints before publishing. Which constraint must the developer respect when attaching layers to this single function?
- AA function may attach an unlimited number of layers as long as each individual layer stays under 50 MB zipped, since the per-layer cap is what Lambda enforces.
- BA function may attach at most five layers, and the unzipped size of the function code plus all attached layers must stay within 250 MB. Correct
- CA function may attach at most ten layers, and only the function code counts toward the 250 MB unzipped limit while layer contents are excluded from it.
- DA function may attach at most five layers, and each layer is measured against its own separate 250 MB unzipped limit independent of the function code size.
Why A is wrong: The 50 MB figure describes direct console zip upload rather than a per-layer cap, and Lambda enforces a hard limit of five layers per function, so unlimited layers is wrong.
Why B is correct: Lambda allows up to five layers per function, and the combined unzipped size of the function code and all attached layers is limited to 250 MB, so both limits apply to the fifth layer.
Why C is wrong: The limit is five layers rather than ten, and layer contents do count toward the 250 MB unzipped total, so excluding them understates the real constraint.
Why D is wrong: The five-layer count is right, but the 250 MB unzipped limit is a single combined budget for code and layers together, not a separate allowance for each layer.