Interview Prep/AWS/ECS, EKS, ECR and Lambda

Deploying fails: `InvalidParameterValueException: Unzipped size must be smaller than 262144000 bytes`.

BeginnerTroubleshootingECS, EKS, ECR and Lambda
Answer

Likely causes → The function code plus all layers is larger than 250 MB unzipped. Large ML libraries (numpy, pandas, torch) or bundled test files and caches usually cause it.

Diagnose →

unzip -l function.zip | tail -1
aws lambda get-function --function-name ml-infer --query 'Configuration.Layers[].CodeSize'
du -sh package/* | sort -h | tail

Fix →

  1. Package the function as a container image (up to 10 GB)
  2. Or remove tests, __pycache__ and docs from the package, and use AWS-provided layers (for example AWS SDK for pandas)

Prevent → Use container images for heavy dependencies, and fail CI builds when package size grows past a set budget.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on ECS, EKS, ECR and Lambda