AWS limits the total code storage for Lambda functions to 75GB.
The main reason of reaching such size is because for every deployment of existing function, AWS stores the previous version ("qualifier").
Usually, when you reach that point, you want to remove old version. This tool will help you to!
Install via source
git clone https://github.com/khanhcd92/clear-lambda-storage-nodejs.git
cd clear-lambda-storage-nodejs/
npm i
node index.js
Provide credentials:
node index.js --access-key <access_key_id> --secret-key <secret_access_key> --num-to-keep <number>
Provide credentials with one region:
node index.js --access-key <access_key_id> --secret-key <secret_access_key> --num-to-keep <number> --regions <region_code>
Provide profile:
node index.js --profile <profile_id> --num-to-keep <number>
Provide profile with one region:
node index.js --profile <profile_id> --num-to-keep <number> --regions <region_code>