Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/epsagon/clear-lambda-storage
Removes old versions of Lambda functions
https://github.com/epsagon/clear-lambda-storage
Last synced: 3 months ago
JSON representation
Removes old versions of Lambda functions
- Host: GitHub
- URL: https://github.com/epsagon/clear-lambda-storage
- Owner: epsagon
- License: mit
- Created: 2018-11-14T12:06:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-15T08:24:50.000Z (about 1 year ago)
- Last Synced: 2024-07-25T12:32:37.737Z (4 months ago)
- Language: Python
- Homepage: https://epsagon.com/blog/how-to-free-aws-lambda-code-storage-codestorageexceeded/
- Size: 32.2 KB
- Stars: 163
- Watchers: 6
- Forks: 43
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-functions - clear-lambda-storage - Removes old versions of Lambda functions of Code Storage. (AWS Lambda Functions)
README
Clear Lambda code storage
===========================Motivation
-----------
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!Setup
-----
Install via pip.. code-block:: bash
pip install clear-lambda-storage
clear_lambda_storageInstall via source
.. code-block:: bash
git clone https://github.com/epsagon/clear-lambda-storage
cd clear-lambda-storage/
pip install -r requirements.txt
python clear_lambda_storage.pyAdvanced usage
---------------Provide credentials:
.. code-block:: bash
python clear_lambda_storage.py --token-key-id --token-secret
Alternate usage:
.. code-block:: bash
python clear_lambda_storage.py --profile --num-to-keep 2
⚡️ `Serverless Framework `_ usage
----------------------------------------------------------
.. code-block:: bashnpm i -g serverless
git clone https://github.com/epsagon/clear-lambda-storage
cd clear-lambda-storage/
serverless deployYou can schedule this Lambda code storage clean to run every period you want:
.. code-block:: yaml
functions:
clear_lambda_storage:
handler: handler.clear_lambda_storage
memorySize: 128
timeout: 120
events:
- schedule: cron(0 12 ? * SUN *) # Run every sunday at 12:00pm UTC